[Solved] How do you instantiate an array in Java? | MCQ

How do you instantiate an array in Java?

a) int arr[] = new int(3);
b) int arr[];
c) int arr[] = new int[3];
d) int arr() = new int(3);

Answer: c
Explanation: Note that int arr[]; is declaration whereas int arr[] = new int[3]; is to instantiate an array.

Comments