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
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