public class TestDemo { public static void showArray(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]+"/t"); } System.out.println(""); } } public static void main(String[] args) { int a[][]=new int[2][2]; a[0][0]=1; a[0][1]=2; a[1][0]=3; a[1][1]=4; showArray(a); int b[][]=new int[2][]; b[0]=new int[2]; b[1]=new int[3]; b[0][0]=1; b[0][1]=2; b[1][0]=3; b[1][1]=4; b[1][2]=5; showArray(b); int c[][]={ {1,2}, {3,4,5} }; showArray(c); } }