0

can anyone explain how example given in multidimensional array works?

in the example we took a 2 dimensional array but assigned with 3 dimensional array how it is going to work

2nd Aug 2016, 6:26 AM
saikiran vempati
saikiran vempati - avatar
1 Respuesta
+ 2
public class Program { public static void main(String[] args) { int[ ][ ] sample = { {1, 2, 3}, {4, 5, 6}, {7}}; int x; x=sample[0][0]; System.out.println(x); x=sample[0][1]; System.out.println(x); x=sample[0][2]; System.out.println(x); x=sample[1][0]; System.out.println(x); x=sample[1][1]; System.out.println(x); x=sample[1][2]; System.out.println(x); x=sample[2][0]; System.out.println(x); } } _________ output : 1 2 3 4 5 6 7
7th Aug 2016, 7:21 AM
Mohammad Reza Karimi
Mohammad Reza Karimi - avatar