This week's book giveaway is in the Agile and Other Processes forum.We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line!See this thread for details.
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
• Devaka Cooray
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Jeanne Boyarsky
• Tim Cooke
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Tim Moores
• Mikalai Zaikin
• Carey Brown
Bartenders:

# arrays

Ranch Hand
Posts: 59
• Number of slices to send:
Optional 'thank-you' note:
when i create a array like follos

int [][][] b=new int[1][][];

how can i assign to this array
please give all the posible ways

author
Posts: 23945
142
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by asanka vithanage:
when i create a array like follos

int [][][] b=new int[1][][];

how can i assign to this array
please give all the posible ways

Well, b is an array to arrays to arrays of int. so, you can assign arrays of arrays of ints to the elements of the b array, since the elements of that array are arrays of arrays of ints.

b[0] = new int[10][12];

And you can assign arrays of ints to the elements of the elements of the b array, since those elements are arrays of ints.

b[0][5] = new int[42];

And you can assign ints to those elements, since those elements are arrays of ints.

b[0][5][23] = 56;

Henry

 I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad: a bit of art, as a gift, the permaculture playing cards https://gardener-gift.com