The code below really confused me. The output is "int array", but if I quote the second Confusing function, the output will be "Obejct". I wonder what null really means in Java.
And also why the Confusing class is created with calling the second constructor while not the first constructor
Why the compiler will call that constructor as it always calls the lowest extension of a class
public class Confusing {
public Confusing(Object o){
System.out.println("Obejct");
if(o instanceof Object)
System.out.println("Object");
}
public Confusing(int[] iArray){
System.out.println("int array");
if(iArray instanceof int[])
System.out.println("Array");
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Confusing(null);
}
}