+ 9

How will you apply the enhanced for loop for 2d array ?

https://code.sololearn.com/c69U8rLGJE4M/?ref=app

18th Jan 2018, 5:23 PM
Aaditya Deshpande
Aaditya Deshpande - avatar
2 Antworten
+ 4
Maybe you can do it like this for(int[] k: myArr){ for(int l: k){ System.out.print(l+" "); } System.out.println(""); }
18th Jan 2018, 5:36 PM
Jente
+ 3
I generally try to stay away from enhanced for loops, but maybe one inside another?
18th Jan 2018, 5:32 PM
Jacob Pembleton
Jacob Pembleton - avatar