Win a copy of Kotlin in Action this week in the Kotlin forum!
programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# Multi dimansional Array,Master Exam

Mushraf Khan
Ranch Hand
Posts: 37
GoodDay EveryOne

This is from Master Exam A ,
Can anyone please clear the the below query. I tried to read some of the post based on this question, got more confused. Can anyone please help me with my below quoted queries. i would really apprecaite. I really need your great help to make this cleared.

A,B,E,F are correct.

A. b2[1][1] = big;----- I guess there are 4 arrays in b2, what does b2[1][1] mean
B b[1][]0] = b3; --- second array, O th element , means second array of b, value of element at index 0 . is this correct
C b2[0][1][1] = b ----- Couldnt figure how b2[0][2][1] has come
D b2[0][2][1] = b[1][0]---- Couldnt figure how this came
E b2[1][1][0][1] = b[1][0] -----Couldnt figure how this came
F b2[1][1] = b ------Couldnt figure how this came

John Jai
Rancher
Posts: 1776

Mushraf Khan
Ranch Hand
Posts: 37
Thanks a lot John. Had always the problem of arrays when it was more than one dimensional. The explaination was crystal clear. Earlier i used to count dont know what in the [] and tried to figure out some logic. This was really clear. Sorry for the late reply , been bit busy with my kids activities.
Thanks again.

Regards
Mushraf Khan

Ankit Garg
Sheriff
Posts: 9610
37
As John explained already you should think of two dimensional arrays as array of arrays, you can read a tutorial like this on this. That is the only reason why its possible to have a two dimensional array with each 'row' having different number of 'columns'...

Mushraf Khan
Ranch Hand
Posts: 37
Thanks a Lot, Ankit Garg. It was really useful information. Broadened my knoweldge about Arrays and best of all understood it. Thanks again.