Ques 1 Array
What will be the output of the following code?
public class Main { public static void main(String[] args) { int[] arr = {1, 2, 3, 4}; System.out.println(arr[4]); } }
Ques 2 Array
What will be the output of the following code?
public class Main { public static void main(String[] args) { int[] arr = new int[3]; System.out.println(arr[0]); } }
Ques 3 Array
Which statement about arrays in Java is true?
Ques 4 Array
What is the length of the array declared as int[][] arr = new int[4][5];?
In Java, the length of a 2D array is determined by the number of rows. For the array declared as int[][] arr = new int[4][5];, the number of rows is 4.