Mark Moge wrote:Can you explain me why the first method is ok and the second one gives a compile error?
yes, Java does not support return-type-based method overloading. Java methods only differ by arguments, not by return type. So, to the compiler the useMe() method and the useMe() method are exactly the same.
That is why the compiler says: useMe() is already defined in A
I have checked again and I can compile it too but my IDE (netbeans) gives me warnings which look like a compile error.
Anyway I dont understand why one method is ok and second one isn't. And if sth is super of K (A<? super K>) then it doesn't have to extends Number (like in a class declaration).