Answer & Solution
Answer: Option D
Solution:
In Java, arrays are objects. They are instances of classes that extend the abstract class java.lang.Object. However, arrays in Java are implemented as objects of a specific type called "Array". This means that arrays in Java are indeed objects, but they are not instances of the Array class; rather, they are instances of classes that are automatically generated by the Java Virtual Machine (JVM) when arrays are created.
Option A: Arrays can change in size after initialization.
In Java, once an array is initialized with a specific size, that size cannot be changed. Arrays have a fixed length determined at the time of creation. While you can create a new array with a different size and copy elements from the old array to the new one to achieve a similar effect, the original array itself cannot change its size.
Option B: Arrays can store elements of different types.
In Java, arrays are homogeneous data structures, meaning they can only store elements of the same type. When you declare an array, you specify the type of elements it can hold. All elements in the array must be compatible with this type.
Option C: Arrays can have a negative length.
In Java, array lengths must be non-negative integers. It is not possible to declare an array with a negative length. Attempting to do so will result in a compilation error.
Therefore, the correct answer is
Option D: Arrays are objects of type Array. Arrays in Java are indeed objects, but they are instances of classes that are automatically generated by the Java Virtual Machine (JVM) when arrays are created. They are not instances of the Array class itself, but they are objects nonetheless.