0

Beginer Help

String array[ ][ ] = { {"Hey", "John", "Bye"}, {"John", "Johnson", "Hello"} }; System.out.println(array[1][1]); Why would the output be Jhonson and not Jhon? I don't understand Multidimensional Arrays.

20th Jul 2020, 8:34 AM
RainbowColorSheep
RainbowColorSheep - avatar
2 Answers
+ 1
array[0][0]="Hey" array[0][1]="John" array[0][2]="Bye" array[1][0]="John" array[1][1]="Johnson" array[1][2]="Hello"
20th Jul 2020, 8:55 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
In programming 0 is the first index of an array so in Samsil Arefeen example you can see with [1][1] that the left side chooses the 2nd group of elements in the array and the right side selects the 2nd element of that group.
20th Jul 2020, 9:13 AM
D_Stark
D_Stark - avatar