+ 2
I DON'T UNDERSTAND HOW THE OUTPUT OF QUESTION 1 ON MULTIDIMENSIONAL ARRAYS == JOHNSON
someone please exaplain how the answer Is Johnson Im completely lost in this lesson on arrays
4 Answers
+ 4
What is the output of this code?
String array[ ][ ] = { {"Hey", "John", "Bye"},
{"John", "Johnson", "Hello"} };
System.out.println(array[1][1]);
You can choose to read it one by one.
E.g.: you can first find out what's array[1].
This would give the output of {"John", "Johnson", "Hello"}.
Then after that, find out what is array[1][1] which is basically array[1] of {"John", "Johnson", "Hello"} which is Johnson.
*** position of array starts from 0.
hence array[1] simply means second position in the array. :)
0
okay thanks alot
0
johnson
0
Johnson