• Post Reply Bookmark Topic Watch Topic
  • New Topic

Two D array  RSS feed

 
Joshua Ebarvia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How come did b became a 2D array?



 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because of the [] immediately after the int. Your code is the same as this:

In Java, you can put the [] either after the type or after the variable name, or you can even mix them (as happens with b above). There are historical reasons for this, Java inherited part of its syntax from C and C++.
 
Joshua Ebarvia
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
now I see it. Thanks

very TRICKY.....
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!