Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Multi-dimensional array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Multi-dimensional array" Watch "Multi-dimensional array" New topic

Multi-dimensional array

Kannan Raju
Ranch Hand

Joined: Jul 07, 2005
Posts: 44

Can someone please explain how the following code works? Thanks.

SCJP1.4<br />SCWCD (in progress)
Marcos Vilela

Joined: Jul 06, 2005
Posts: 18
String[][][] arr ={

{ { "a", "b", "c"}#arr[0][0]#, {"d", "e", null}#arr[0][1]# }, //arr[0][][]
{ {"x"}#arr[1][0]#, null }, //arr[1][][]
{ {"y"}#arr[2][0]#}, //arr[2][][]
{ { "z", "p"}#arr[3][0]#, {}#arr[3][1]# } //arr[3][][]


To get �y� -> String test = arr[2][0][0];
To get �null� ->String test1 = arr[0][1][2];

[ July 15, 2005: Message edited by: Marcos Vilela ]
[ July 15, 2005: Message edited by: Marcos Vilela ]
Shweta R Dhaneshwar
Ranch Hand

Joined: May 27, 2005
Posts: 35
Think of this in terms of array of arrays.

Shweta Dhaneshwar.<br />SCJP 1.4 90%
I agree. Here's the link:
subject: Multi-dimensional array
It's not a secret anymore!