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);
}
}
one question about overloading
Moderator: admin
-
- Posts: 53
- Joined: Thu Nov 22, 2012 12:01 am
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: one question about overloading
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?
Who is online
Users browsing this forum: Bing [Bot] and 23 guests