Question : Multidimensional Java Array
Answered by : unsightly-unicorn-1cjun9udyrbh
class multiDimensionalArray
{ public static void main(String args[]) { int multiDimensional[][] = { {1,2,3},{4,5,6},{7,8,9} }; for (int i=0; i< 3 ; i++) { for (int j=0; j < 3 ; j++) System.out.print(multiDimensional[i][j] + " "); System.out.println(); } }
}
Source : https://softhunt.net/how-to-initialize-an-array-in-java-with-examples/ | Last Update : Tue, 04 Jan 22
Question : display two dimensional array java
Answered by : kos-pter
//this way u can print your array row by row
for (int i = 0; i < row; i++){ for (int j = 0; j < column; j++){ System.out.println(array[i][j]); }
}
//this way u can print your array column by column
for (int i = 0; i < column; i++){ for (int j = 0; j < row; j++){ System.out.println(array[i][j]); }
}
Source : | Last Update : Sat, 28 May 22