-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharr2d.java
More file actions
32 lines (24 loc) · 835 Bytes
/
arr2d.java
File metadata and controls
32 lines (24 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.*;
public class arr2d {
public static void main(String[] args) {
int[][] arr={
{1,2,3},
{4,5,6,7},
{8,9},
};
System.out.println(arr.length);
// System.out.println();
// //2D ARRAYS MODIFICATION
// for(int i=0;i<arr.length;i++){
// for(int j=0;j<arr[i].length;j++){
// System.out.print(arr[i][j]+" "); //System.out.println(Arrays.toString(arr));
// }System.out.println();
// }
// for(int i=0;i<arr.length;i++){
// System.out.println(Arrays.toString(arr[i]));//printns each row by row
// }
for(int[] num:arr){//enhanced for loop
System.out.println(Arrays.toString(num));
}
}
}