aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "generics doubt from nikos" Watch "generics doubt from nikos" New topic
Author

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"....by 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%
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: generics doubt from nikos