*
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


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

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: array gotchas
 
Similar Threads
Sun Cirtification
Array declaration
What are the main advantages of Mughal's book, compared to K&B Book?
K&B , Chap1 Q11
MultiDimensional Arrays