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