This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Two D array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Two D array" Watch "Two D array" New topic
Author

Two D array

Joshua Ebarvia
Ranch Hand

Joined: Sep 25, 2007
Posts: 70
How come did b became a 2D array?





Lovin' java
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

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++.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Joshua Ebarvia
Ranch Hand

Joined: Sep 25, 2007
Posts: 70
now I see it. Thanks

very TRICKY.....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Two D array
 
Similar Threads
Two dimensional Array (Strange thing)
How many dimensions?
Arrays
Array declartions
array dimension confusion