File APIs for Java Developers Manipulate DOC, XLS, PPT, PDF and many others from your application. http://aspose.com/file-tools
Big Moose Saloon
 Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies Register / Login Win a copy of Java Interview Guide this week in the Jobs Discussion forum!

# Multi dimansional Array,Master Exam

Mushraf Khan
Ranch Hand

Joined: May 04, 2011
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

Joined: May 31, 2011
Posts: 1776

Mushraf Khan
Ranch Hand

Joined: May 04, 2011
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

Joined: Aug 03, 2008
Posts: 9466

20

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

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Mushraf Khan
Ranch Hand

Joined: May 04, 2011
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.

I agree. Here's the link: http://aspose.com/file-tools

subject: Multi dimansional Array,Master Exam