This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.
    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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

JavaRanch Exclusive! temporary K&B 5 errata

 
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,

Haven't got this up on the website yet, but here's the current errata for the K&B SCJP 5 book. If I've missed any let me know in this thread, or better yet in an email!

hth,

Bert



[ March 01, 2006: Message edited by: Bert Bates ]
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Bert

I purchased the book last week.The information which you hav posted wil be useful me.

The K&B book is very nice.
Thanks a lot for ur wonderful work.

warm regards
devika
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Great Bert!thanks a lot!!
 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Bert,

I think there's one more errata to our list. I've just sent an email too.

Chapter 9, Page 711, Paragraph 5th

Original Statement :
5. Within the block, output the StringBuffer 100 times and then increment
the letter in the StringBuffer. You can check Chapter 5 for StringBuffer
methods that will help with this.

Replaced one :
5. Within the block, output the StringBuffer 100 times and then increment
the letter in the StringBuffer. You can check Chapter 6 for StringBuffer methods that will help with this.


Chapter 5 no longer mention StringBuffer or StringBuilder objects.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

I've got the 1.4 book (darn, I should have got the 1.5!). Where can I find errata for the 1.4 book?

thanks much

GrahamO
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Graham Walsh:
Hi,

I've got the 1.4 book (darn, I should have got the 1.5!). Where can I find errata for the 1.4 book?

thanks much

GrahamO



K & B 1.4 errata
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Here is some more errata I've compiled that weren't listed:

p.45, Synchronized Methods, "We'll discuss this nearly to death in
Chapter 11"-->"We'll discuss this nearly to death in
Chapter 9" [there is no chapter 11]

p. 175, figure 3-1, String object "Aiko"-->"Fido"

p.253 "...don't put any essential code into your finalize()"-->same
text but font for 'f' in finalize fixed to be same as rest of the
word

p.258 "Using == with wrappers is tricky; wrappers with the same small
values (typically lower than 127), will be ==, larger values will
not be ==." --> this is only true for *boxed* wrappers and ones
lower then 128.

p322, Exam Watch, "But the only variable that can be assigned (rather
than tested against something else) is a boolean; all other
assignments will result in something non-boolean, so they're not
legal..."

This may be precisely true, but somewhat misleading in that
Boxing adds a bit on this since:

Boolean boo = false;
if (boo = true) {} *will* compile and execute.

p441, "Take special note of the what the readline() method
returns."-->"Take special note of what the readline() method
returns."

p492, under Serialization, "The key method you invoke to serialize an
object is writeObject(), and to deserialize an object invoke
readMethod()." --> change readMethod() with readObject().

p497, "You should understand the Pattern compile() method and the
Matcher matcher(),...--> change matcher() to matches()

p513, #7, alternate solution is to have 'try' moved down to just
enclose 'file.createNewFile();', since mkdir() doesn't throw
any checked exception.

p562, "It's important to know that the order of objects printed in the
second for loop is not prdictable: HashSets and LinkedHashSets
do not guarantee any ordering."

I believe this is incorrect about LinkedHashSets, which
guarantee ordering by insertion order.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
page 364 , you missed a semicolon when calling doStuff()
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Here is a couple of things I found:

page 233 in the table Boolean.valueOf(String) is listed as throwing a NumberFormatException but it does not (only the instances of java.lang.Number throw NFE).

page 439 There are two ways to create a file: point 2 states that FileReader and FileInputStream will create a file if it doesn't exist. This is incorrect, these classes will throw a FileNotFoundException if the file does not exist.

Kristian
[ April 10, 2006: Message edited by: Kristian Perkins ]
 
Kristian Perkins
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Sorry to say I have a couple more:

page 216: The second code sample under the section "Initializing Elements in a Loop" shows:
is incorrect in regard to initialising the myDogs array. New Dog objects will be created, but they will be thrown away and all elements in the array will remain null (I know because I have been bitten by this before).

page 370: Chapter locations of some of the Exception types seem to be off, i.e. NumberFormatException is in chapter 3 not 6, IllegalArgumentException in chapter 5 not 3, IllegalStateException I couldn't find and NoClassDefFoundError is hinted at in chapter 10 such as pg. 768 "... javac complains that it can't find a class ..." but doesn't mention NoClassDefFoundError specifically.

By the way, this book is full of great content for the 1.5 exam and is highly recommended.

Kristian
[ April 10, 2006: Message edited by: Kristian Perkins ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Kristian,
Why will the new Dog objects be thrown away and not assigned to the array elements? Please explain it.
 
Kristian Perkins
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
with the for each loop, you don't have direct access to the array references, you only have a copy of the references in the array so you cannot change the original Object references inside the array.
the previous code is equivalent to this:


The for each loop can't change the reference of the array elements, where as the old style for loop listed here can (because you have direct access to manipulate each reference in turn through myDogs[i] = new Dog()).

Hope that helps.
Kristian
 
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Kristian Perkins:
with the for each loop, you don't have direct access to the array references, you only have a copy of the references in the array so you cannot change the original Object references inside the array.
the previous code is equivalent to this:


The for each loop can't change the reference of the array elements, where as the old style for loop listed here can (because you have direct access to manipulate each reference in turn through myDogs[i] = new Dog()).

Hope that helps.
Kristian



Kristian,
Is this because in a "for each" loop you are really using the some iterator method that has a type Dog? And as you stated not really access the reference to the Dog Array?
 
Djoga Djogov
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thanks Kristian.
I got it now. Looks like this is a flaw in the new for each loop which makes it pointless to some extend, because initializing arrays would be one of its main purposes.
Djoga
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Didn't see this one here...

p541 paragraph 1 - typo "king of order" should be "kind of order"
 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
259 &
266 suggest To avoid confusion with the 'wrapper pool':
Q-2, Short story = 5; s/b Short story = 200;


now wat will be the difference n can a short wrapper be able to store more than 127?
 
Higgledy Smith
Ranch Hand
Posts: 193
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am not trying to be dense. But what does this mean in Bert's post to this thread:

bump


 
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 Lavanya - let's keep this thread just for the errata - there is another thread that's busy discussing this topic thanks

Higgledy - bump just means if you add a post to an old thread it "bumps" it back to the front page
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
In the top of the page 319 there is a sentence that says:

"Once an else if succeds, none of the remaining else ifs or elses will be tested"

The word elses suggest that you can have zero or more "else" clauses which is not true.
 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
OMG.... I should have seen this thread before buying it yesterday!!

Hi Bert! So where can we check the finalized errata?
 
Kristian Perkins
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Here ara a few more:

page 234: replace both occurrences of

with

page 381:
the swich code sample, the case statements for 1, 2 and 3 need break statements to prevent fall through to the "We're never supposed to get here!" default case. Also in the paragraph below replace 'x must be either 2, 3 or 4' with 'x must be either 1, 2 or 3'.

page 631: Q 13 Answer, last sentance replace 'methods are not defined in the List interface.' with 'methods are not defined in the Arrays or Collections classes.'
[ April 10, 2006: Message edited by: Kristian Perkins ]
 
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
I sent an email off to the publisher late last week to get started on the official errata page - we'll let you know when it's available.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Bert pg 94 i feel that this example is wrong

public class Horse extends Animal {
private Halter myHalter;//it should be private Halter myHalter = new Halter();
public void tie(LeadRope rope) {
myHalter.tie(rope); // Delegate tie behavior to the
// Halter object
}
}
public class Halter {
public void tie(LeadRope aRope) {
// Do the actual tie work here
}
}



plz confirm
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
p581 Exam Watch at bottom of page:
...even if that Object reference points (yuck) to an Integer(or some other primitive) on the heap.

Primitive? On the heap? It should be Wrapper object, surely?
[ April 11, 2006: Message edited by: Barry Gaunt ]
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
On page 682, under exam watch:

Runnable r = new Runnable();
...

I don't think it is legal since you cannot instantiate an interface.
 
Kristian Perkins
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Eddie,

No it is not legal and is mentioned in the updated errata
 
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
This thread is locked.

The updated K & B errata list is here:

https://coderanch.com/t/253802/java-programmer-SCJP/certification/Updated-Errata
 
The glass is neither half full or half empty. It is too big. But this tiny ad is just right:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
    Bookmark Topic Watch Topic
  • New Topic