This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Array Declaration Doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Array Declaration Doubt" Watch "Array Declaration Doubt" New topic
Author

Array Declaration Doubt

Jayant Raj
Ranch Hand

Joined: Mar 11, 2004
Posts: 42
Hi All,

Please refer to the following code :



Q. Why is there a compile time exception at 2 ?
Q. Is a5 a 1-D array & a6 a 2-D array ?


regards,<br />Jayant Raj<br /> <br />SCJP 1.4 [98%]<br />SCWCD 1.4 [91%]<br />SCBCD [In Progress]
Sebastien Col
Greenhorn

Joined: Aug 18, 2005
Posts: 13
Hi,

Q. Why is there a compile time exception at 2 ?
R. Because of the [] that is before the a4 identifier. The first part of the line says that you're declaring int arrays, the first one being named "a3". Then, after the coma, you must have only identifiers, as following:

int []a3, a4;

Q. Is a5 a 1-D array & a6 a 2-D array ?
R. Yes. a5 is an int[], and a6 is an array of int[].

Sebastien.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Array Declaration Doubt