• 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:
  • 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

Can anyone talk me through 3d array

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, if my question is not allowed,please forgive me,I don't want to offend any one.
I need to do a 3d array, I have tried but always get stuck! I want to learn java so I am not asking for the code.
What i would like if some one to talk me through it step by step, by e-mail.
I will do all the work, describe the array,and create it.But step by step if you can confirm i am right at each stage. That way if I make a mistake along the way you can stop me. Allowing me to learn this problem. Again I stress I'm not asking for the code, just for some one to guid me
please.
If this is not possible I will understand
and I wish you all and your families good luck and good health, as you have answered question for me in the pass , which I will always be gratefull.
Lindsey
Lindsey_ship@yahoo.com.uk
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lindsey,
Java doesn't really have multi-dimensional arrays. You can, however, have arrays within arrays, within array...etc. The syntax is only slightly different from other languages that support multi-dimensional array.
// normal array of int with six elements
int[] normal = {0, 1, 2, 3, 4, 5};
// simulate two dimensions: the following
// shows an array that has three element,
// with each element being an array with
// two int elements
int[][] twoDims = {{0, 1}, {2, 3}, {4, 5}};
The leftmost array index refers to elements in the outermost array and the rightmost array index refers to elements in the innermost arrays. Thus,
twoDims[0][0] is 0
twoDims[0][1] is 1
twoDims[1][0] is 2
twoDims[1][1] is 3
twoDims[2][0] is 4
twoDims[2][1] is 5
You can extend this pattern to simulate 3 or more dimensions.
HTH
 
Lindsey Ship
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Junilu, for a fast response
I will keep trying later to do it.
Lindsey.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic