package com.Summer_0421.cn;
import java.lang.reflect.Array;
import java.util.Arrays;
/**
* @author Summer
* 二维数组遍历的方式for普通循环和foreach循环、toString遍历
*/
public class Test03 {
public static void main(String[] args) {
show1();
show2();
show3();
}
private static void show3() {
int[][] its = new int[][]{{1},{1,2},{1,2,3},{1,2,3,4}};
for (int i = 0; i < its.length; i++) {
System.out.println(Arrays.toString(its[i]));
}
}
private static void show2() {
int[][] its = new int[][]{{1},{1,2},{1,2,3},{1,2,3,4}};
for (int[] is : its) {
for (int i : is) {
System.out.print(i+" ");
}
System.out.println();
}
}
private static void show1() {
int[][] its = new int[][]{{1},{1,2},{1,2,3},{1,2,3,4}};
for (int i = 0; i < its.length; i++) {
for (int j = 0; j < its[i].length; j++) {
System.out.print(its[i][j]+" ");
}
System.out.println();
}
}
}