What happens when the code that follows is executed?
int[] nums = new int[4];for (int i = 0; i <= nums.length; i++)
{
nums[i] = i;
}
System.out.println(nums[2]);
a. It prints "3" to the console.
b. It prints "2" to the console.
c. It prints "1" to the console.
d. It throws an ArrayIndexOutOfBoundsException
Answer: d. It throws an ArrayIndexOutOfBoundsException