One can assign values of arbitrary types to elements of an array.
Elements of arrays are untyped
The type of an array specifies the type of the elements
CorrectionHere is what's right.
The following code is illegal:
int a = new int; a = "Hi"; // type error a = 12; a = 13.5; // type error
Like everything in Java, arrays are strongly typed. If we have an array of type
int, we can only assign values of type
int to its elements.