Page 1 of 1

one question about overloading

Posted: Sun Mar 23, 2014 12:52 am
by icepeanuts
Who would explain why the output for the code below is "double []"?
Thanks.

class Test {
private Test(Object o) {
System.out.println("Object");
}
private Test(double [] arr) {
System.out.println("double []");
}

public static void main(String[] args) {
new Test(null);
}
}

Re: one question about overloading

Posted: Sun Mar 23, 2014 2:57 am
by admin
It is quite simple if you know what is meant by "most specific" method concept. null can be passed to Object as well as double[], but which is more specific?