Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Multidimensional arrays

 
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In K & B SCJP 6, solution I came across a statement "Multidimensional arrays' dimension can be inconsistent". Does it mean that the individual arrays of an array of arrays can have different dimensions? The following is the program:



Does the statement refer to the fact that dd has arrays with 3 and 4 elements?

The solution is 4 (dd[1][2])

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that is correct. The size of an int[][] doesn't have to be a square. Example

 
shuba gopal
Ranch Hand
Posts: 87
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Wouter
 
Sheriff
Posts: 21943
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's why a lot of people don't like the term "multidimensional arrays". They are arrays of arrays (of arrays etc).
 
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic