+ 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

9th Feb 2017, 11:19 AM
Vandik Alvandi
Vandik Alvandi - avatar
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
9th Feb 2017, 5:15 PM
Shubham G
Shubham G - avatar
+ 4
thanks very very much sir i appreciate your answer. and now i understand how to describe the multidimensional arr
10th Feb 2017, 3:48 PM
Vandik Alvandi
Vandik Alvandi - avatar
+ 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}.
9th Feb 2017, 11:28 AM
Zilvinas Steckevicius
Zilvinas Steckevicius - avatar
+ 2
it's good example for understanding multidimensional array
11th Feb 2017, 6:03 PM
Ashok
Ashok - avatar
+ 1
i thinks so
12th Feb 2017, 3:39 PM
Vandik Alvandi
Vandik Alvandi - avatar