What is the output of this code ?
int array[][] = { {3, 5, 8 }, {7, 54, 1, 12, 4 } };
System.out.println(array[0][2] );
Answers
Answered by
4
Answer:
8
Explanation:
For arrays the indexing starts from 0
This is a 2D array,
The first row has index 0.
So, [0][0]=3 [0][1]=5 [0][2]=8
[1][0]=7 [1][1]=54 [1][2]=1 [1][3]=12 [1][4]=4
Hence array[0][2]=8.
Similar questions
Math,
5 months ago
Math,
5 months ago
English,
10 months ago
Math,
1 year ago
Computer Science,
1 year ago