Java - Arrays
Given
int[] nums = {10, 20, 30, 40, 50};, which loop correctly prints all elements using the array's length property?int[] nums = {10, 20, 30, 40, 50};, which loop correctly prints all elements using the array's length property?length - 1.nums.length - 1. Options B and D start at 1, missing the first element. for(int i = 0; i <= nums.length; i++) { System.out.print(nums[i] + " "); } goes to nums.length, causing an IndexOutOfBoundsException.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions