Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Updated K&B 5 Errata - 4/16

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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?
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Sheriff
Posts: 11606
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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 ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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.
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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() + " ");
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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 ]
    Bookmark Topic Watch Topic
  • New Topic