+ 3
for multi dimensional array u need to have 2 loops running ! for better understanding draw matrix put some value & den try to write the code
24th Oct 2017, 8:11 AM
Yaseen Shariff
Yaseen Shariff - avatar
+ 2
//You can use enhanced for loop like this: public class Program { public static void main(String[] args) { int [][][] sample = { { {1, 2, 3}, {4, 5, 6} }, {{19, 20, 21}}}; for(int[][] i: sample){ for(int[] j: i){ for(int k: j){ System.out.print(k); } System.out.println(); } System.out.print(""); } } }
24th Oct 2017, 10:44 AM
Ferhat Sevim
Ferhat Sevim - avatar