aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Updated K&B 5 Errata - 4/16 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply locked New topic
Author

Updated K&B 5 Errata - 4/16

Torsten Jordt
Greenhorn

Joined: Jun 13, 2006
Posts: 2
A question on page 473 (and similar on page 483). There is a code construct like this:

{
Pattern p = Pattern.compile("ab");
Matcher m = p.matcher("abaaaba");
boolean b = false;
while (b = m.find()) {
System.out.print(m.start() + " ");
}
}


The construct is surprising because the variable b is never read (but assigned twice). I would expect a while loop which just performs a test on "m.find()". Are there any specific reasons for using the variable b in the code?
Swapnil Trivedi
Ranch Hand

Joined: Jun 06, 2006
Posts: 106
dear Bert:
I was just wondering, that in Q5 of chapter 1 (page 78)
you are saying that for javabeans naming convention the valid prefixes are: "get" and " is" .
I just want to ask why it's not "add".

On the other hand you have said in your two minutes drill(page 68) that depending on method's purpose,it could start from set,get,is,add and remove


regards
swapnil


SCJP 5.0<br />-----------<br />"Help Ever && Hurt Never"
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5200
    
  12

wondering if this is an erratum in the book or it's only in my mind

this is the link

[EDIT] I tested it today with some samples (see link for results), but conclusion is that this is really an Erratum in the book (IMHO)
[ June 19, 2006: Message edited by: Roel De Nijs ]

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Rick Dakota
Greenhorn

Joined: Jun 22, 2006
Posts: 2
I have possible Errata with the following questions from the LearnKey Master exam on the CD:

Q47 - The reference information is correct, but the "correct answers" are set up as those which will compile, instead of those which will not -- so this question is always scored incorrectly.

Q56 - "C" and "D" are both listed as correct answers, but I think "D" is incorrect. If "rate" has a value of zero, then the equals method will be less precise than the hashCode method.

Q35 - This question asks "Which results are NOT possible?", and one of the correct answers listed is "An error occurs at runtime." How is it ever possible to exclude the possibility of a run-time error (ie. hardware failure, operator kills the process, etc.)?

Q57 - The reference information correctly shows "C" as the answer, but the question is always scored incorrectly showing "A" as the answer.

Q53 - The answer lists "is-a relationships always rely on polymorphism" as a true statement. I had always thought that "is-a relationships can use polymorphism, but it's also possible to use encapsulation and inheritance without dynamic binding". In Chapter 2, in the two-minute drill under polymorphism (the last bullet on page 153) it states: "Polymorphic method invocations apply only to overridden instance methods." I know, instance is italicized, but can't you also read the statement straight-up? If I have a sub-class with no methods, where is the polymorphism?
[ June 24, 2006: Message edited by: Rick Dakota ]
Ram Kumar
Ranch Hand

Joined: Jun 19, 2006
Posts: 39
on page 731, 2 minute drill for Threads you see this below;

"When the sleep or wait is over, or an object's lock becomes available, the
thread can only reenter the runnable state. It will go directly from waiting to running (well, for all practical purposes anyway)."

When the wait is over the objects gets into runnable state (from wait or sleep), but immediately in the next sentence it is mentioned it will directly go running.

Does the thread transition from waiting>runnable>running or wait>running directly ?

Can someone please clarify.

Thanks a lot.


-- SCJP 5, OCPJBCD 5, OCPJWSD 5 (in progress)
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8813
    
    5
Hi Guys -

We've just returned from some extended business travel (okay, there was a little vacation thrown in there too ).

I'm still getting used to being back in the mountain time zone, but in the next few days I'll take a look at these new questions, and update / consolidate the errata list. Thanks for your help and your patience, and good luck in your studies!

Bert


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Biby Thoms
Ranch Hand

Joined: Jan 10, 2006
Posts: 48
K&B book page 517 question 12.
Which answer is true? Based on K & B A and B are correct. But when I am running the script, I am always getting false, false
==========================
import java.io.*;
class Directories {
static String [] dirs = {"dir1", "dir2"};
public static void main(String [] args) {
for (String d : dirs) {
// insert code 1 here
File file = new File(path, args[0]);
// insert code 2 here
}
}
}
and that the invocation
java Directories file2.txt
is issued from a directory that has two subdirectories, "dir1" and "dir2", and that "dir1" has a
file "file1.txt" and "dir2" has a file "file2.txt", and the output is "false true", which
set(s) of code fragments must be inserted? (Choose all that apply.)
A. String path = d;
System.out.print(file.exists() + " ");
B. String path = d;
System.out.print(file.isFile() + " ");
C. String path = File.separator + d;
System.out.print(file.exists() + " ");
D. String path = File.separator + d;
System.out.print(file.isFile() + " ");


Thanks<br />Biby Thoms
Mohamed Mahrous
Greenhorn

Joined: Jul 06, 2006
Posts: 3
in page 272,273

the answer for

Question 12: At what point is only a single object eligible for GC?

is: G. An exception is thrown at runtime.

but the question not asked for the result? what you think?

I think the answer is: A. After line 8 runs.
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8813
    
    5
Hi Guys -

Okay, I started to work on these new entries and I realized that I've done a bad job of setting up this whole "errata" thing. My bad, sorry.

My sense is that some of the entries on this thread are really just "doubts", in other words a rancher isn't sure if something is correct, so he/she adds it to this errata thread. I think this is probably not a great approach.

Here's what I'd like to propose:

1 - When you have a doubt about something in the book, start a new thread, with a heading something like: "Doubt in K&B concerning topic X". Then of course make your posting about your doubt.

2 - If you collective ranchers come to agree that it's an official errata, I'll add it to the errata thread.

3 - Once we've mostly agreed to this plan, I'll clean up this thread, removing any "doubts" so that it contains only official errata - then I'll keep this thread closed so that it can be a read-only list.

So, this means that the following ranchers might have to make a new post:

Biby Thoms
Mohamed Mahrous
Ramkumar Sridharan
Rick Dakota
Roel De Nijs
Swapnil Trivedi
Torsten Jordt

It's possible that some of the older posts on this thread also fall into this category.

Note that I'm not yet saying for sure that none of these entries are errata, it's just that I think some of them aren't, so I'd like to open them each up for the standard SCJP doubt/discussion approach.

Thoughts?

Bert
Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
Hi Bert,

are you going to summarize the errata?
or at least give us your view on some topics posted here? I think only some important ones will do.

many thanks
anthony


SCJP 5
Ted Clark
Greenhorn

Joined: Jul 18, 2006
Posts: 6
Is there an update summary of the verified errata for S/B's SCJP 5 Study Guide since the one published in April? If so, where might I find it?
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8813
    
    5
Dang! I was hoping to get some response from the earlier posters who had, imho, mostly doubts - not really confirmed errata. For now I think I'll lock this thread, and consider everything listed after my initial list to be a doubt.

So, if anyone thinks that something on this list is more than a doubt, my request is that you open up a new thread, get concensus, and I'll update the list from there.

Hope this works for everyone!

Bert
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8813
    
    5
Hey Ranchers,

Please go to this SCJP thread for the updated list!

"K & B, SCJP 5 - Errata: Updated 7/28/06"

Thanks!

Bert
[ July 28, 2006: Message edited by: Barry Gaunt ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Updated K&B 5 Errata - 4/16