java↗6-6. 2차원 배열
1차원 배열이 여러개 모인 것이 2차원 배열 int[][] score = new int[4][3]; score[0][0] = 100; // 배열 xocre의 1행 1열에 100을 저장 System.out.println(score[0][0]); // 배열 score의 1행 1열의 값을 출력 2차원 배열의 초기화 int[][] arr = new int[][] { {1,2,3},{4,5,6} }; int[][] arr = { {1,2,3},{4,5,6} }; // new int[][]가 생략됨 (주로 사용) int[][] arr = { {1,2,3},{4,5,6} }; // 위와 동일하지만 보기가 쉬움 2차원 배열 예제 class Ex5_5 { public static void main(String[] arg..
2024.03.21