package cn.hncu;
public class ShuZu2 {
/**
* @param args不规则数组
*/
public static void main(String[] args) {
int [][]a = new int[3][];//只指定行数,不指定列数
a[0] = new int[3];
a[1] = new int[6];
a[2] = new int[5];
a[0][1]=1;
a[1][2]=2;
a[2][3]=3;
print(a);
}
private static void print(int[][] a) {
for(int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){//列
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
public class ShuZu2 {
/**
* @param args不规则数组
*/
public static void main(String[] args) {
int [][]a = new int[3][];//只指定行数,不指定列数
a[0] = new int[3];
a[1] = new int[6];
a[2] = new int[5];
a[0][1]=1;
a[1][2]=2;
a[2][3]=3;
print(a);
}
private static void print(int[][] a) {
for(int i=0;i<a.length;i++){
for(int j=0;j<a[i].length;j++){//列
System.out.print(a[i][j]+" ");
}
System.out.println();
}
}
}