I have a quick and straighforward question:
I have this simple class:
public class A { public void m(Object o) { System.out.println("m with Object called"); } public void m(Number n) { System.out.println("m with Number called"); } public static void main(String[] args) { A a = new A(); // why will m(Number) be called? a.m(null); } } UPDATE: actually is method with Number actually being called. Sorry about the confusion.
If I call a.m(null) it calls method with Number parameter.
My question is: why is this? where in the java language specification is this specified?
nullis not aNumberobject, thus it falls into the more generalizedObjectbucket.