This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes multi dimension array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "multi dimension array" Watch "multi dimension array" New topic
Author

multi dimension array

priya selva
Greenhorn

Joined: Feb 21, 2002
Posts: 29
Can any one help me how to interpret this?...
thanks in adv
Priya...
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ August 17, 2002: Message edited by: Dirk Schreckmann ]
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
What exactly do you want to know about it?


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Can any one help me how to interpret this?
String[][][] arr declares a three dimensional String array. The components of the first dimension, must be two dimensional String arrays (or null). The components of the second dimension must be single dimension String arrays (or null). The components of the third dimension must be Strings (or null).
The first component of the first dimension is the two dimensional String array { { "a", "b" , "c"}, { "d", "e", null } } . This two dimensional String array has two components in its first dimension. Each of these components is a single dimension String array with three components.
The second component of the first dimension of the arr array is { {"x"} , null } . This two dimensional String array has two components - a single dimension String array and a null value. The single dimension String array has one component - "x" .
The third component of the first dimension of the arr array is { {"y"} } . This two dimensional String array has one component - a single dimension String array with one component - "y" .
The fourth component of the first dimension of the arr array is { {"z","p"}, {} } . This two dimensional String array has two components. The first component is a single dimension String array with two components - "z" and "p" . The second component of the two dimensional String array is an empty single dimension String array with no components.
Since array components are numbered beginning with zero, arr[0][1][2] refers to the third component in the third dimension of the second component in the second dimension of the first component in the first dimension. This is the value null.
[ August 17, 2002: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Have you tried compiling and running this? I think it will cause an ArrayIndexOutOfBounds exception.
Why do you think that?
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Because I didn't read it properly ... and I'll delete my message now.
priya selva
Greenhorn

Joined: Feb 21, 2002
Posts: 29
Thank u Dirk for ur help....
I can understand that clearly now....
Once again Thanks a lot ...
Priya
 
GeeCON Prague 2014
 
subject: multi dimension array