• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multi dimension array

 
priya selva
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly do you want to know about it?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried compiling and running this? I think it will cause an ArrayIndexOutOfBounds exception.
Why do you think that?
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because I didn't read it properly ... and I'll delete my message now.
 
priya selva
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u Dirk for ur help....
I can understand that clearly now....
Once again Thanks a lot ...
Priya
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic