This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help about generics
 
Similar Threads
Generics Problem
confused with generics
Java Generics
How do you extend a generic abstract class
Examlab generics question