- What is the output of the following code?
int[] numbers = {1, 2, 3, 4, 5};
System.out.println(numbers[3]);
Ans. 4.
2.
What is the output of the following code snippet?
int[] numbers = {1, 2, 3, 4, 5};
for(int i=0; i<numbers.length; i++)
System.out.print(numbers[i] + ” “);
}
Ans. 1 2 3 4 5.
