Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
Programmer Certification (OCPJP)
Multi-dimensional array
Kannan Raju
Ranch Hand
Posts: 44
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Can someone please explain how the following code works? Thanks.
public class StringArrayTest { public static void main(String[] args) { String[][][] arr = { { { "a", "b", "c"}, {"d", "e", null} }, { {"x"}, null }, { {"y"}}, { { "z", "p"}, {} } }; System.out.println(arr[0][1][2]); } }
SCJP1.4<br />SCWCD (in progress)
Marcos Vilela
Greenhorn
Posts: 18
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 35
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi,
Think of this in terms of array of arrays.
Shweta Dhaneshwar.<br />SCJP 1.4 90%
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Arrays
Problem in Arrays passing.
Array.length
What is the input file?
Array Problem
More...