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:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# Multidimensional Arrays

Ranch Hand
Posts: 246
• Number of slices to send:
Optional 'thank-you' note:
Hi Co-ranchers,

I am looking for tutorial(s)/topics/articles on multidimensional arrays. Please suggest. Your help will be highly appreciated.

Thanks,

Naveen Katoch

Ranch Hand
Posts: 952
• Number of slices to send:
Optional 'thank-you' note:

Multidimensional array:
Two dimensional array is an array of array.
three dimensional array is an array of array of array.
Sounds scary na!!!

int [][] array=new int[2][2];

array[0]------> will point to another array of size 2.
and another array will be like:
array[0][0],array[0][1]

same applies for array[1];
array[1][0], array[1][1];

declaring and initializing:
int [][] array={{1,2},{2}};
here
array[0]={1,2};
and
array[1]={2};

[ December 07, 2008: Message edited by: Punit Singh ]

Ranch Hand
Posts: 226
• Number of slices to send:
Optional 'thank-you' note:
Hi,

The Sun tutorials have a small section on multidimensional arrays:

http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html

Other sources:

http://math.hws.edu/eck/cs124/javanotes3/c8/s5.html

http://www.unix.com.ua/orelly/java-ent/jnut/ch02_09.htm

However, the K&B book does cover multidimensional arrays in detail. It might be worth getting that book:

http://www.amazon.com/SCJP-Certified-Programmer-Java-310-065/dp/0071591060/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1228671522&sr=8-1

nav katoch
Ranch Hand
Posts: 246
• Number of slices to send:
Optional 'thank-you' note:
Thanks so much Punit and Santiago. I appreciate it.

Naveen