Module: | Classes, Objects, OOPs & Inheritance
Q34: Consider the following statements regarding array memory allocation in Java:
1. In Java, arrays are dynamically allocated strictly in the Heap memory, even if they are defined to exclusively store primitive data types like 'int' or 'char'.
2. When an array of object references is initialized without providing explicit elements, the Java compiler automatically populates every index slot with the 'null' reference to prevent garbage data reads.
3. The physical size of a Java array can be dynamically increased after initialization by utilizing the standard assignment operator to insert new values beyond its original declared capacity.
Which of the above statements is/are correct?
2. When an array of object references is initialized without providing explicit elements, the Java compiler automatically populates every index slot with the 'null' reference to prevent garbage data reads.
3. The physical size of a Java array can be dynamically increased after initialization by utilizing the standard assignment operator to insert new values beyond its original declared capacity.
Which of the above statements is/are correct?
✅ Correct Answer: A
🎯 Quick Answer:
The correct combination is 1 and 2. Statement 3 is incorrect because standard Java arrays have a strictly fixed length; their capacity cannot be mutated once instantiated in memory.Structural Breakdown: When the syntax 'new int[5