• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ask About Array Multidimensional

 
Ranch Hand
Posts: 32
MySQL Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hay all master, i am confused about array mutidimensional.
I wonder, how many object can construct for this array?



Thank you
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You first. How many do you think?
 
Fandy Akhmad
Ranch Hand
Posts: 32
MySQL Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure, honestly i don't know.
Once i think 3*9 = 12 is number of object, but i am wrong. It's number of element.

In my book that i read, it has 4(1+3) object.
I confused . Please explain to me.

Thank you for your response.

Darryl Burke wrote:You first. How many do you think?

 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java doesn't really have multi-dimensional arrays. Instead, what it has is arrays-of-arrays. Given that, does that number make sense now?
 
Fandy Akhmad
Ranch Hand
Posts: 32
MySQL Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Matthew Brown wrote:Java doesn't really have multi-dimensional arrays. Instead, what it has is arrays-of-arrays. Given that, does that number make sense now?



Yes, of course Java builds multi-dimensional arrays from many one-dimensional arrays.
Just now, i get some reference , it says :

This actually allocates 6 objects: a one-dimensional array of 5 elements for each of the rows, and a one-dimensional array of ten elements, with each element pointing to the appropriate row array.
This case for array :


It is correct?

I am sorry for my bad english.
Thank you.
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Fandy Akhmad wrote: . . .
This actually allocates 6 objects: a one-dimensional array of 5 elements for each of the rows, and a one-dimensional array of ten elements, with each element pointing to the appropriate row array.
. . .
It is correct?
. . . .

No. 1 + 10 = 6???

That statement is incorrect in two respects.
  • 1: It does not only allocate space, but also creates the objects.
  • 2: When I was a little boy at school, 1 + 10 always made 11
  • Please tell us where you found that statement.
    reply
      Bookmark Topic Watch Topic
    • New Topic