Since the following expression on the RHS creates an array object: -
new Integer[2];
So, your reference type on the LHS should be compatible to be able to hold a reference to an array.
Now, since array in Java is a subtype of Object, so an Object type can hold a reference to an array.
But, an Integer reference of course cannot point to an array.
So,
Object ob = new Integer[2]; // is valid. as `Object` type reference can point to an array object
Integer i = new Integer[2]; // is not valid. as `Integer` type reference cannot point to an array object.
Objectis the mother of all classes -- all other classes inherit from it.IntegerandInteger[]are two different classes where neither inherits from the other.Integer[2]. The type of arrays ofIntegerobjects is writtenInteger[].Integer[]is a distinct class fromInteger. The array size is not a part of the class identity, though. (But also understand thatInteger[][]is a distinct class fromInteger[].)