I have two classes:
public class ClassA {
public void method(Number n) {
System.out.println(\"ClassA: \" + n + \" \" + n.getClass());
}
}
Your issue stems from the fact that (as quoted from the official Java tutorials on Inheritance):
In a subclass, you can overload the methods inherited from the superclass. Such overloaded methods neither hide nor override the superclass methods—they are new methods, unique to the subclass.`
Refer to the official Java tutorials for more details: http://docs.oracle.com/javase/tutorial/java/IandI/override.html