Skip to content

Commit a0c1a5c

Browse files
2D array input output operation.
1 parent 747c774 commit a0c1a5c

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

TwoDArray.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
1+
62
package basicjava;
73

8-
/**
9-
*
10-
* @author Asus
11-
*/
4+
import java.util.Scanner;
5+
6+
127
public class TwoDArray {
13-
8+
public static void main(String[] args) {
9+
Scanner input = new Scanner(System.in);
10+
int[][] arr = new int[3][3];
11+
12+
for (int i = 0; i < 3; i++) {
13+
for (int j = 0; j < 3; j++) {
14+
arr[i][j] = input.nextInt();
15+
}
16+
}
17+
for (int i = 0; i < 3; i++) {
18+
for (int j = 0; j < 3; j++) {
19+
System.out.print(arr[i][j]+" ");
20+
}
21+
System.out.println();
22+
}
23+
}
1424
}

0 commit comments

Comments
 (0)