Explain this code, please. Code public class Question8 { public static void main(String[] args) { int[] nums = {2, 4, 6, 8}; for (int i = 0; i < nums.length; ++i) System.out.println(\"nums[\" + i + \"] = \" + nums[i]); System.out.println(); fun(nums); for (int i = 0; i < nums.length; ++i) System.out.println(\"nums[\" + i + \"] = \" + nums[i]); } public static void fun(int[] arr) { for (int i = 0; i < arr.length; i+=2) arr[i] -= 1; } } Run nums[0] = 2 nums[1] = 4 nums[2] = 6 nums[3] = 8 nums[0] = 1 nums[1] = 4 nums[2] = 5 nums[3] = 8 Solution In the first loop i start at value 0 and in each iteration we are printing (\"nums[\" + i + \"] = \" + nums[i]). So for i = 0 this becomes nums[0] = 2. Next the value of i becomes 1 and then 2 and then 3 and the loop breaks. Now we call the function fun in which there is a loop. The value of i initially is 0 and we are subtracting one from it. So the value of nums[0] becomes 1 and now the value of i becomes 2 and nums[2] becomes 5 and then the value of i becomes 4 and the loop exits. That explain the first set of output. nums[0] = 2 nums[1] = 4 nums[2] = 6 nums[3] = 8 So now with the loop the values of nums will be 1,4,5,8. Because the values are changed in the function. That explain the second set of output. nums[0] = 1 nums[1] = 4 nums[2] = 5 nums[3] = 8 .