• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Array

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ..
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


will create an array containing three references to int arrays.

Initially these array references are null.

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks patel,

now I got the clear picture
 
Skool. Stay in. Smartness. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic