Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multidimensional Arrays

 
Brian Deer
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am having a hard time wrapping my mind around the multidimensional array concept.

If I have an array declaration of:

double d[][][] = new double [3][][];

How would one explain best what this would hold?
 
Yeming Hu
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
take array as an object, therefore double[][][] is a reference type whose object holding reference variables to double[][], double[][] is a reference type whose object holding reference variables to double[]. You know how double[] works.
 
chaitanya gopal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
double d[][][] = new double [3][][];

here d holds three double[][] arrays.

ex:
d[0]=a[][];
d[1]=b[][];
d[2]=c[][];

got it..

chaitanya.
 
Nik Arora
Ranch Hand
Posts: 652
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brain,
This was discussed earlier. Refer to this LINK




Regards
NIK
SCJP 1.5
 
Brian Deer
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very helpful. thank you!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic