-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathj30MultiDimension.java
More file actions
30 lines (24 loc) · 896 Bytes
/
j30MultiDimension.java
File metadata and controls
30 lines (24 loc) · 896 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
import java.util.Scanner;
public class j30MultiDimension {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
// MultiDimensional Array
int [][] arr = new int [2][3];
// input an MultiDimensional array
System.out.println("Input Array is : ");
for (int x = 0 ; x < arr.length; x++){
for(int y = 0; y < arr[0].length; y++){
System.out.printf("\nEnter the value of arr[%d][%d] : " , x , y);
arr[x][y] = sc.nextInt();
}
}
// print an Multi Dimensional Array
System.out.println("\n\nPrinted Array is : ");
for(int [] arr1 : arr){
for (int a : arr1){
System.out.printf("\n __%d__",a);
}
}
// System.out.println(arr.length);
}
}