How come I can assign an array to an object reference
Object x = (Object) new int[] { 1, 2, 3 };// no error
Object y = new int[] { 1, 2, 3 };//no error
Do java arrays inherit from Object similar to classes?
I expected this to give me a compile time error.
Doing this:
System.out.println(x.toString() + " " + x.getClass().getName() + " " + x.getClass().getTypeName());
Results in:
[I@15db9742 [I int[]