I read that null
isn\'t an instanceof
anything, but on the other hand that everything in Java extends Object
class.>
Hoping that this example clears your doubt :
public void printObject(Object object) {
System.out.println("object referred");
}
public void printObject(double[] doubleArray) {
System.out.println("Array of type double");
}
public static void main(String[] args) {
JavaNullObjectTest javaNullObjectTest = new JavaNullObjectTest();
javaNullObjectTest.printObject(null); //Array of type double
javaNullObjectTest.printObject((Object)null); //object referred
}
We can but, convert a 'null' to object.