File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Array" Watch "Array" New topic


Sathya Shanmugam
Ranch Hand

Joined: Mar 02, 2007
Posts: 45
Hi folks,

Whether constructor is created in array object?

And also i don't understand this statement

int [] [] myarray = new int[3][]

usually my childhood memories about 2 dimensional array should be like this
int [][] myarray = new int[3][5]

That means 3 rows and 5 columns, but in java I don't understand..

Could anyone pls give some explanation..

Pls give me some example ..
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2398

will create an array containing three references to int arrays.

Initially these array references are null.

Pankaj Patel
Ranch Hand

Joined: Jul 13, 2006
Posts: 73
You Think That java doesnot support more than one dimensional array. If you see two dimensional array then it is array of Array. if you find three dimensional array then it is array of array of array. And So on...

1) int [] [] myarray = new int[3][]
Here in this case you are specifything that you have array with contains another array into it.

Now if you want all statement 1,2,3 and four into one line then you can do it as, int[][] myarray = new int[3][4].

Now assume, you want a zigzag array. So in that case what you will do?
In this case following code will come to rescue.

I hope this will help you little.
Sathya Shanmugam
Ranch Hand

Joined: Mar 02, 2007
Posts: 45
thanks patel,

now I got the clear picture
I agree. Here's the link:
subject: Array
It's not a secret anymore!