class jamesprogram { public static void main(String args[]){ int firstarray[][]={{4,5,6},{10,20,30}}; int secondArray[][]={{100,200,300},{45},{3,4,5,6,7,8}}; System.out.println("First array "); show(firstarray); System.out.println("Second array "); show(secondArray); } // make a new method to display this stuff in // a table public static void show(int c[][]){ //one loop to loop through rows for (int row=0;row<c.length;row++){ // one loop to loop through columns for (int column=0;column<c[row].length; column++){ System.out.print(c[row][column]+"\t"); } System.out.println(); } } }
Outputs:
First array
4 5 6
10 20 30
Second array
100 200 300
45
3 4 5 6 7 8