Meaningless Drivel is fun!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes generics doubt from nikos Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "generics doubt from nikos" Watch "generics doubt from nikos" New topic

generics doubt from nikos

Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521

scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later" someone unknown
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

No they are not the same. See the difference with extends and super.
With q1 there is an guaranty that all the elements are a Number or a subclass of it.
So you can retrieve elements like this:

With q2 there is an that the queue can hold elements of type Integer and subclasses of it.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
no matter what is on the right side when you assign both left sides should be compatible.

SCJP 1.6 96%
I agree. Here's the link:
subject: generics doubt from nikos
It's not a secret anymore!