-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTwoDArrayInput.java
More file actions
36 lines (30 loc) Β· 1 KB
/
Copy pathTwoDArrayInput.java
File metadata and controls
36 lines (30 loc) Β· 1 KB
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
package day5;
import java.util.Arrays;
import java.util.Scanner;
public class TwoDArrayInput {
/*
time complexity: O(1)
space complexity: O(1)
*/
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// int rows = scanner.nextInt();
// int[][] data = new int[rows][];
// for (int row = 0 ; row < rows ; row++) {
// int length = scanner.nextInt();
// data[row] = new int[length];
// for (int index = 0 ; index < length ; index++) {
// data[row][index] = scanner.nextInt();
// }
// }
// System.out.println(Arrays.deepToString(data));
int[][] data = new int[3][4];
for (int row = 0 ; row < 3 ; row++) {
// int length = scanner.nextInt();
for (int index = 0 ; index < 4 ; index++) {
data[row][index] = scanner.nextInt();
}
}
System.out.println(Arrays.deepToString(data));
}
}