-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_2D.java
More file actions
44 lines (31 loc) · 946 Bytes
/
Array_2D.java
File metadata and controls
44 lines (31 loc) · 946 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
33
34
35
36
37
38
39
40
41
42
43
44
/*public class Aarray2D {
public static void main(String[] args) {
int[][] matrix = new int[2][2];
matrix[0][0]=1;
matrix[0][1]=2;
matrix[1][0]=3;
matrix[1][1]=4;
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
System.out.print( matrix [i] [j] + " " );
}
System.out.println(" ");
}
}
}*/
import java.util.Scanner;
public class Array_2D {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int size=3;
System.out.println("matrix");
int[][] matrix=new int[size][size];
for(int i=0;i<size;i++){
for(int j=0;j<size;j++){
matrix[i][j]=input.nextInt();
System.out.print(matrix[i][j]+" ");
}
System.out.println();
}
}
}