-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathArrayMultiEx02_03.java
More file actions
36 lines (31 loc) · 1000 Bytes
/
ArrayMultiEx02_03.java
File metadata and controls
36 lines (31 loc) · 1000 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
package classes;
/*
HWJava10_07_ArrayMultiEx02_03_배재연.java
*/
class ArrayMultiEx02_03
{
public static void main(String[] args)
{
int[][] arrMultiEx02 = new int[2][3]; // 2차원 배열2 선언 + 생성
int[][] arrMultiEx03 = new int[][] {{10, 20, 30}, {40, 50, 60}}; // 2차원 배열3 선언 + 생성 + 값할당
int cnt = 0;
for(int i = 0; i < arrMultiEx02.length; i++){
for(int j = 0; j < arrMultiEx02[0].length; j++){
cnt++;
arrMultiEx02[i][j] = cnt;
}
} // 2차원 배열2에 값 할당
for(int i = 0; i < arrMultiEx02.length; i++){
for(int j = 0; j < arrMultiEx02[0].length; j++){
System.out.print(arrMultiEx02[i][j]+"\t");
}
System.out.println("\n");
} // 2차원 배열2 값 행 렬 시각화 출력
for(int i = 0; i < arrMultiEx03.length; i++){
for(int j = 0; j < arrMultiEx03[0].length; j++){
System.out.print(arrMultiEx03[i][j]+"\t");
}
System.out.println("\n");
} // 2차원 배열3 값 행 렬 시각화 출력
}
}