File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "need help about generics " Watch "need help about generics " New topic

need help about generics

Tom Mark

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:
subject: need help about generics
It's not a secret anymore!