Accenture Java Programming Practice Question
Determine the output: public class A { public static void main(String argv[]) { int ary[]=new int[]{1,2,3}; System.out.println(ary[1]); } }Answer options
A
2
B
1
C
Compilation Error:incorrect syntax The array ary is initialized with 3 elements and the element at the first index is 2.
Correct answer: 2
Explanation
Correct answer: 2.