Rob Harris

+ Follow
since Nov 11, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rob Harris

I learned K&B pretty much word for word and scored 100% on Collections questions. Learn which class to use for a particular job spec., which is synchronized, double-linked etc etc and you'll be fine.
s and s2 are not the same object, despite containing the same content, so that makes 5. If the line initialising s2 read
s2 = s;
then there would be 4.

1. You're not using a Vector to wrap your integer values, you're using the Integer Wrapper class. This turns your int primitives into Objects so they can be added to the collection.

2. Lines 1, 2 and 3 retrieve the Integer objects from the Vector. Vector.size() returns the number of components in the Vector and get() retrieves the objects using their index (just like an array).

3. The code compiles and runs fine for me.

Hope this helps!

SCJP 1.4
I agree with Erin - the Sierra/Bates book tells you everything you need to know.
Read it once more, with feeling. They know what they're talking about. Trust me - I passed last week (and I have no idea what I'm talking about).

SCJP 1.4
Make sure you know which methods belong to String, e.g., concat() and which to StringBuffer, e.g., append(). Remember that the substring(int beginIndex, int endIndex) uses a zero-based beginIndex but starts with 1 for the endIndex - (and has en evil lower-case 's' in substring).

But most of all, understand the difference between Strings - immutable objects - and StringBuffers - not-so-immutable objects.
String s = new String ("Java");
s.concat(" Rules!");
StringBuffer sb = new StringBuffer("Java");
s.append(" Rocks!");

Java Rocks

The line of code
s.concat(" Rules!");
created a new String "Java Rules!", but didn't attach a reference to it!

Have fun.

SCJP 1.4
for questions organised by topic. Although I found some of his questions were a bit repetitive, they hammer home the same principles tested in the exam.

You can also go to
to register (free) and download a practice exam. It's very like the actual exam, with 60-odd timed questions. I was got 86% in this and got 83% in my SCJP, so they're spot on the difficulty level.
Ouch! Yes ofcourse, the array is also an object: #3. Thanks
Your references are:
a - the reference to the array
a[0] = reference to object Obj# 1
a[1] = null
a[2] = null
b - reference to Obj# 2

Good luck!
Just passed my SCJP 1.4. Thanks for all those questions and replies people posted - they really helped. And a big plug for Sierra & Bates book - I wouldn't have got any Thread questions right without their help.