What's wrong in this code below | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's wrong in this code below

public class Program{ public static void main(String [ ] args){ int [ ] [ ] myArr= {{1,2,3},{4,5,6}}; System.out.println(myArr[ ] [ ]); } }

24th Jul 2018, 6:02 PM
Nathan
Nathan - avatar
3 Answers
+ 2
I think you should choose and specify the indexes in the array when you print if you mean to print specific number in the array. If you want to print all of the elements in the array you can do it with loop.
24th Jul 2018, 7:44 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
So this code can't print all the elements right... Thanks man i got it
24th Jul 2018, 7:56 PM
Nathan
Nathan - avatar
0
You're welcome. Just try it with loops.
24th Jul 2018, 8:49 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar