0

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

The output of this program is 4,how?

16th Jul 2020, 10:26 AM
Saurav Menon
Saurav Menon - avatar
6 Réponses
+ 2
Share your post next time or put the code in description and not in title. https://www.sololearn.com/post/467576/?ref=app 1 2 3 4 5 6 4 is at 1st row and 0th column.
16th Jul 2020, 11:43 AM
Avinesh
Avinesh - avatar
+ 2
Saurav Menon That is two dimensional array and here on 0 index array is {1, 2, 3} and on 1st index array is {4, 5, 6} So according to your problem on sample [1] [0] 1st index array has 3 values and 4 is on 0th index so sample [1][0] = 4
16th Jul 2020, 12:30 PM
A͢J
A͢J - avatar
0
Huh, I am not a java expert but this code doesn't look valid first of all and then there is no print statement, how can you even get output?
16th Jul 2020, 10:31 AM
Shahil Ahmed
Shahil Ahmed - avatar
0
Oops sorry for that, silly me
16th Jul 2020, 10:35 AM
Shahil Ahmed
Shahil Ahmed - avatar
0
Double dimensional array, a[row][column]=a[1][0]-->4(output).
16th Jul 2020, 6:34 PM
shubham kumar
shubham kumar - avatar