Q. What is the output of the following code?
Code:int[] arr = new int[]{1, 2, 3, 4, 5};
System.out.println(arr[5]);
β
Correct Answer: (D)
ArrayIndexOutOfBoundsException
Explanation: The array index 5 is out of bounds, since the array has only 5 elements.