🔍아래의 원소를 나열하는 방법은?
int[][] arr2D = {{1,2,3},{4},{5,6}};
✏️Answer
int[][]arr2D = {{1,2,3},{4},{5,6}};
for(int[]i : arr2D) {
for(int s : i) {
System.out.print(s);
}
}
int[][]arr2D = {{1,2,3},{4},{5,6}};
for(int i = 0; i < arr2D.length; i++) {
for(int s : arr2D[i]) {
System.out.print(s);
}
}