aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes need help about generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "need help about generics " Watch "need help about generics " New topic
Author

need help about generics

Tom Mark
Greenhorn

Joined: Jun 15, 2011
Posts: 27
Why does the method below compiles?


and these two don't?




I know that when you call the method, you can declare V to be anything at all. And it's not ok.
But what about this method:

T can be B or C, but the argument of this method can be anything C, B, A and also Object because of "super" keyword (Letter<? super T> t) .
This is not within the bounds of the class declaration (public class Letter<E extends B>{}) .
Can you explain how the compiler works?
 
Consider Paul's rocket mass heater.
 
subject: need help about generics