jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes array gotchas Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "array gotchas" Watch "array gotchas" New topic

array gotchas

Steven Broadbent
Ranch Hand

Joined: Dec 10, 2002
Posts: 400
I'm looking for any potential gotchas I might have missed.
A couple of points I came across:-

From K & R
int [] x , y ; //defines two arrays of ints
int x [], y; //defines one array of ints and one int primitive
K and R states that if [] follows the type then all variables in the declaration are arrays. Otherwise the [] must follow each array name in the declaration.
From Dan's exam:-
int []a3,[]a4;
does not compile, because the [] must be placed after the type or identifier.

None of these seem to be covered in S & B. Am I just getting pre-exam jitters or what?

"....bigmouth strikes again, and I've got no right to take my place with the human race...."<p>SCJP 1.4
Tom Purl
Ranch Hand

Joined: May 24, 2002
Posts: 104
Don't sweat this type of stuff too much. The exam's purpose isn't to give you every possible permutation of an array declaration to see if you have a java compiler built into your brain. The exam is a good test of your array knowledge, but it doesn't do this by using gimmicky questions.

Tom Purl<br />SCJP 1.4
I agree. Here's the link: http://aspose.com/file-tools
subject: array gotchas
It's not a secret anymore!