File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "array" Watch "array" New topic
Author

array

Shalini Srivastav
Ranch Hand

Joined: Jul 21, 2012
Posts: 86

I drew this 3d array to know how will it look.Do you think is it correct?


[Thumbnail for untitled.JPG]

Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 498

Yes, that's correct!


PM Me If You Want to get Urgent Help on Java Programming
Yogesh Gnanapraksam
Ranch Hand

Joined: Dec 17, 2009
Posts: 133
I have this kind of picture in mind when I think of 3-d arrays. I am not sure whether the ordering is important...



[Thumbnail for 3-dimension-array.png]

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38519
    
  23
There is no such thing as a 3D array in Java. that is an array of arrays of arrays. I cannot understand your diagram.
Yogesh Gnanapraksam
Ranch Hand

Joined: Dec 17, 2009
Posts: 133
we are talking about the same thing..array of arrays or multidimensional array ..

From the documentation

You can also declare an array of arrays (also known as a multidimensional array) by using two or more sets of square brackets, such as String[][] names. Each element, therefore, must be accessed by a corresponding number of index values.
Jo Joseph
Greenhorn

Joined: Nov 28, 2010
Posts: 23
The concept what you are thinking is right...
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

array[1] =(index0 has)> array[1] =(index0 has)> array[0] so, array of array(s) of array(s) ... easy to understand ? :P
Shalini Srivastav
Ranch Hand

Joined: Jul 21, 2012
Posts: 86
Array of arrays doesn't clear dimension, how anyone can mention that this is [][] or [][][] ? In your term both are array of arrays.so we student like to use 2D for [][] and 3D for [][][].
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

I know it is common practice to say n D(dimension) . but at least for me it is always clear array holds arrays rather than 2D.
Rameshwar Soni
Ranch Hand

Joined: Feb 03, 2011
Posts: 247
Shalini Srivastav wrote:Array of arrays doesn't clear dimension, how anyone can mention that this is [][] or [][][] ? In your term both are array of arrays.


Arrays of arrays----------[][]

arrays of arrays of arrays -----------[][][] and so on
Shalini Srivastav wrote: so we student like to use 2D for [][] and 3D for [][][].


I too used to tell them the way you are telling, but i have seen Campbell, Fred etc always telling that its incorrect to tell them 2-D or 3-D etc, so i think we should learn properly and more importantly correctly.

Because when we would face interviews, what we tell as a student won't count but the correct things would count and matter.


Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18765
    
  40

Rameshwar Soni wrote:
Shalini Srivastav wrote: so we student like to use 2D for [][] and 3D for [][][].


I too used to tell them the way you are telling, but i have seen Campbell, Fred etc always telling that its incorrect to tell them 2-D or 3-D etc, so i think we should learn properly and more importantly correctly.

Because when we would face interviews, what we tell as a student won't count but the correct things would count and matter.


Another way to think about it ... the concept of a 3D array imply that there is such a thing -- meaning a type that is a 3D array. And there isn't....



may look like a single object, and hence, a 3D array object is being instantiated. However, the code is syntactic sugar. Under the hood, the compiler is generating code that looks more like this....



It is, under the hood, implemented as array of arrays. And not the traditional matrix multidimensional array as implemented in languages like C / C++.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38519
    
  23
You can do things with arrays of arrays which you can’t do with real multidimensional arrays. For example, you can alter the size of one of its elements by re‑assigning it, which you can’t do with a true multidimensional array.
Neither the link you quoted, nor the real documentation (the Java Language Specification) says 2D array, 3D array, or similar. In fact, in the sentence after what you quoted, it says
In the Java programming language, a multidimensional array is simply an array whose components are themselves arrays.
They are simply using multidimensional for an array of arr...ays, without specifying the number of [] pairs.
Yogesh Gnanapraksam
Ranch Hand

Joined: Dec 17, 2009
Posts: 133
ok.So it is misleading to say 'nth dimension' ,probably the term 'nth dimension' applies to mathematical model ..etc.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: array