java multidimensional array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

java multidimensional array

How it is can be 4? can you explain please? int[ ][ ] sample = { {1, 2, 3}, {4, 5, 6} }; int x = sample[1][0]; System.out.println(x); // Outputs 4

27th Nov 2016, 6:35 PM
Gaye
2 Answers
+ 1
it is so simple >>your zero index in the array is another array contains 3 number , you 1 index also is another array which is {4,5,6} you zero index of that array is 4 so , you zero index in the array which is the 1 index in the big array in 4 hope u get it
27th Nov 2016, 6:43 PM
Asmaa Ramadan
Asmaa Ramadan - avatar
+ 1
Thank you so much
27th Nov 2016, 6:56 PM
Gaye