Suppose that we have the following two dimensional array Wha
Suppose that we have the following two dimensional array. What is the output of each of the followings?
int[][] num = { { 3, 2, -1, 3}, {-2, 4, 7, -3}, {9, 4, -1, 0},{2, 8, -3, 7 }};
System.out.println(num.length);
System.out.println(num[2].length);
System.out.println(num[3][0]);
System.out.println(num[2][3]);
System.out.println(num[0][3]);
System.out.println(num[2][2]);
System.out.println(num[0][0]);
Solution
col1 col2 col3 col4
3 2 -1 3 row 1
-2 4 7 -3 row 2
9 4 -1 0 row 3
2 8 -3 7 row 4
System.out.println(num.length); 4 //Which denotes no of rows in the 2-Dimensional array
System.out.println(num[2].length); 4 //No of elements in the column 3
System.out.println(num[3][0]); 2 //First element in the row 4
System.out.println(num[2][3]); 0 //fourth element in the row 3
System.out.println(num[0][3]); 3 //Fourth element in the row 1
System.out.println(num[2][2]); -1 // Third element in the row 3
System.out.println(num[0][0]); 3 // First element in the first row
![Suppose that we have the following two dimensional array. What is the output of each of the followings? int[][] num = { { 3, 2, -1, 3}, {-2, 4, 7, -3}, {9, 4, - Suppose that we have the following two dimensional array. What is the output of each of the followings? int[][] num = { { 3, 2, -1, 3}, {-2, 4, 7, -3}, {9, 4, -](/WebImages/39/suppose-that-we-have-the-following-two-dimensional-array-wha-1120618-1761596280-0.webp)