Java OCA OCP Practice Question 363

Question

Given the following code:

class MyClass { 
     int[] ages; 
     int[] myIntArray = new int[10]; 
} 
  • A. Which statements are true?
  • B. ages is initialized to null.
  • C. ages is initialized to a reference to an array with zero elements.
  • D. myIntArray is initialized to null.
  • E. myIntArray is initialized to a reference to an array with zero elements.
  • F. myIntArray is initialized to a reference to an array with 10 elements.


A, E.

Note

ages is a reference, so in the absence of initialization code it is initialized to null.

myIntArray is initialized; the array contains 10 floats that are initialized to 0f.




PreviousNext

Related