+ 5
Multidimensional arr
i confused when i learn multidimensional of array. now see this. int [][] sample = {{2,3,4}},{{789}}; int x = sample [0] [1]; system.out.println (x); i dont understand the code above. please help me guys
5 Respuestas
+ 11
THE SIMPLE WAY TO STUDY THE MULTIDIMESTIONAL ARRAY LETS UNDERSTAND THE POSITIONS OF ROW & COLUMN
LETS TAKE A EXAMPLE
ARR[2][2]
THE POSITIONS ARE ROW & COLUMN
0,0 0,1 0,2
1,0 1,1 1,2
2,0 2,1 2,2
IF WE HAVE ARR{{1,2,3},{4,5,6},{7,8,9}}
WE CAN WRITE AS
1 2 3
4 5 6
7 8 9
WHERE ARR[0][0]=1 , ARR[0][1]= 2, ARR[0][2]=3, ARR[1][0]=4, ARR[1][1]=5, , ARR[1][2]=6, ARR[2][0]=7, ARR[2][1]=8, ARR[2][2]=9
IN 1,2 THE FIRST ONE IS D POSITION OF ROW & SECOND ONE IS POSITION OF D COLUMN IT WOKS IN COORDINATE X,Y,Z
IN ARRAY THE NO OF ROWS & COLUMN R (LENGTH-1)
HOPE THIS WILL HELP YOU TO UNDERSTAND BRO THANKS
+ 4
thanks very very much sir i appreciate your answer. and now i understand how to describe the multidimensional arr
+ 2
It should be {{1,2,3},{789}}. To make it simple it's an array of {a, b}, where a is another array {1,2,3} and b is a single element array {789}.
+ 2
it's good example for understanding multidimensional array
+ 1
i thinks so