Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"

Chris Judd

+ Follow
since Feb 25, 2007
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 Chris Judd

Can that be legit and legal? There are places that charge for these books, I can't image why this site would be able to give them away.
I took a look at the Head First book (you can download the first 3 chapters for free)...perhaps this is the best resource. I'm just holding out hope that there is a resource out there that is as complete and useful as the Bates/Sierra SCJP book, but for C#. The head first format is good, don't get me wrong, but I am just hoping there is that complete analog out there somewhere. Dang, we have it good in Java!
I know this is off topic, but I will hope that it will be allowed. I earned my SCJP in 2007 in very much a large part due to this community and to the wonderful Bates/Sierra SCJP book. I loved the experience that I could go through the book, try all of the examples, ask questions here and take the assessments in the book. It was a really efficient way to learn a lot about Java in a very short period of time. Now I am in a different part of my career and I would like to go through a similar process to learn C#. Are there any similar resources that anyone would be willing to share about a book that walks through the fundamentals of C#/.NET all the way to the advanced features of the framework like the Bates/Sierra book? Thank you for your help and for allowing this off topic question.
Hi Ranchers,

I just completed the SCJP 5 exam and I am considering my next move. Could anyone compare the effort footprints between the SCJP and the SCWCD and their experiences with both exams?

Also, I felt the Kathy and Bates book was right on the money for the SCJP, is their Head First book as good for this certification? Are there any other books that you recommend instead?

Fellow Ranchers,

I am happy to post that I have passed the SCJP, and beside just blowing my own horn here, I'd like to share my process for those of you in route.

First, I used the book (Kathy Sierra and Bert Bates). I can't recommend this enough. It really does a great job preparing your for the exam. 5 stars! I read the whole book, did all of the exercises and then after reading the book I went back and did the exercises again. When I missed one, I'd go look up the answer, no matter if it was a easy question or a hard one. Make sure you "get" the fundamental stuff, if you don't its impossible and frustrating. Keep going though the 2 minute drills. Do all of the examples, don't just "think" you get it, prove it to yourself and see if it complies and runs. Read them over and over again until you understand them and if you don't, go back and look it up and if you still don't get it, post your question on the SCJP forum. I can not tell you how much the Java Ranch community has helped me. I would get high quality responses to any question that I had and most of the time it was almost instant. I wish software vendors had the same support as the Java Ranch!

Secondly, I bought mock exams. First I bought Whizlabs, but I found a lot of the questions weren't the same as the book. I decided that I would like to buy additional mock exams and I purchased JQPlus. That is a great product. It really recommend it. It is a great value at $25 (US).

Third, once I passed the mock exam (just one in fact) I went ahead and scheduled the test. I reviewed all of the 2 minute drills and took notes. I studied my notes the morning of the exam and then took the test.

Java Ranch is a great resource, it really help me learn Java!

Yea and thanks,
Chris Judd
11 years ago
I'm having a hard time understanding why E is considered a correct answer to this question. The book lists NumberFormatException as a Programmatically throw exeption. I thought that means that it is a checked can I tell what is a checked excption and what is an unchecked exception?

Thanks for your help,

From 400 Chapter 5: Flow Control, Exceptions, and Assertions of the K & B book:

class Master {
String doFileStuff() throws FileNotFoundException { return "a"; }
class Slave extends Master {
public static void main(String[] args) {
String s = null;
try { s = new Slave().doFileStuff();
} catch ( Exception x) {
s = "b"; }
// insert code here

Which, inserted independently at // insert code here, will compile, and produce the output
b? (Choose all that apply.)
A. String doFileStuff() { return "b"; }
B. String doFileStuff() throws IOException { return "b"; }
C. String doFileStuff(int x) throws IOException { return "b"; }
D. String doFileStuff() throws FileNotFoundException { return "b"; }
E. String doFileStuff() throws NumberFormatException { return "b"; }
F. String doFileStuff() throws NumberFormatException,
FileNotFoundException { return "b"; }
Wow, that is tricky. I understand you explanations. Thanks very much all.

K & B SCJP 5 page #493 "...remember that serialization is about instances, so static variables aren't serialized."

But that doesn't agree with this example. Can anyone shed light on this?

public class TestSer {
public static void main(String[] args) {
SpecialSerial s = new SpecialSerial();
try {
ObjectOutputStream os = new ObjectOutputStream(
new FileOutputStream("myFile"));
os.writeObject(s); os.close();
System.out.print(++s.z + " ");
ObjectInputStream is = new ObjectInputStream(
new FileInputStream("myFile"));
SpecialSerial s2 = (SpecialSerial)is.readObject();
System.out.println(s2.y + " " + s2.z);
} catch (Exception x) {System.out.println("exc"); }
class p implements Serializable {}
class SpecialSerial extends p {
transient int y = 7;
static int z = 9;
That's great. Thanks so much for clearing that up.

Can anyone explain why this code outputs 3 4?

I don't understand why it would widen to Number and not to Long?


class Eggs {
int doX(Long x, Long y) { return 1; }
int doX(long... x) { return 2; }
int doX(Integer x, Integer y) { return 3; }
int doX(Number n, Number m) { return 4; }
public static void main(String[] args) {
new Eggs().go();
void go() {
short s = 7;
System.out.print(doX(s,s) + " ");
} }
Thank you so much, JB. That helps alot.

Could someone explain to me why this code outputs:
m 3 x 2


class base{
int x = 2;
int method(){return x;}
class a extends base{
public static void main(String[] args){
base b = new a();
System.out.println("m " + b.method() + " x " + b.x);
int x = 3;
int method(){return this.x;}