What is the output of the following Java program?
import java.util.*;
class ArrayGames {
public static void main(String[] args) {
int[] a = {1,2,3,4,5};
System.out.println(a[1]);
}
}
This program will display the second element of the array at index 1:
2
Comments
Leave a comment