wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Can anyone talk me through 3d array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Can anyone talk me through 3d array" Watch "Can anyone talk me through 3d array" New topic
Author

Can anyone talk me through 3d array

Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
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
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

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


Junilu - [How to Ask Questions] [How to Answer Questions]
Lindsey Ship
Greenhorn

Joined: Feb 07, 2003
Posts: 19
Thanks Junilu, for a fast response
I will keep trying later to do it.
Lindsey.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Can anyone talk me through 3d array
 
Similar Threads
Convert Into Java Code.
How to survive inJava market?
How to get max hike ?
Questions needed
Java 3D