-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiDimenArray.java
More file actions
28 lines (27 loc) · 791 Bytes
/
MultiDimenArray.java
File metadata and controls
28 lines (27 loc) · 791 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
import java.util.*;
public class MultiDimenArray {
public static void main(String[] args) {
int[][] arr = new int[2][3];
arr[0][0] = 101;
arr[0][1] = 102;
arr[0][2] = 103;
arr[1][0] = 104;
arr[1][1] = 105;
arr[1][2] = 106;
System.out.println("Printing 2-D array");
// 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.print(" ");
// }
// System.out.println();
// }
for (int[] row : arr) {
for (int column : row) {
System.out.print(column);
System.out.print(" ");
}
System.out.println();
}
}
}