Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multidimensional arrays  RSS feed

 
shuba gopal
Ranch Hand
Posts: 85
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])

 
Wouter Oet
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: 85
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Wouter
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java 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).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!