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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Updated K&B 5 Errata - 4/16

 
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



Howdy Ranchers!

At the risk of having errata on our errata, we post here, with some trepidation, an updated list of errata for the K&B SCJP 5 book.

I have excluded really minor typos from this list like if "king" should be "kind". When the book is reprinted those minor fixes will be made too, but I thought they just kind of cluttered up the list.

As always, if you find more errata, or, (yikes!), errata in these errata, or I missed any that you think aren't minor, you can post them here or send me an email.

Thanks for your patience!

Bert


SCJP 5 - Errata 4/16/06

page...type......description

..9....clarify...Listener methods must end in "Listener"

.41....typo......2nd declaration s/b: final int recordNumber

.45....x-ref.....Synchronized para. s/b: Chapter 9

74.....bug.......Q-2: answers A-D were: public Bark speak()...
& 77...............................s/b: public void speak()...

.94....clarify...code was: private Halter myHalter;
......................s/b: private Halter myHalter = new Halter();

115....clarify...last sentence before exam watch s/b:

If any superclass in its inheritance tree has already provided concrete (i.e., non-abstract) method implementations, then, regardless of whether the superclass declares that it implements the interface, the subclass is under no obligation to re-implement (override) those methods.

115....bug.......exam watch was: a.doDogStuff();
............................s/b: d.doDogStuff();

133....bug.......3rd row, 2nd column was: class Foo {
.....................................s/b: public class Foo {

174....clarify...line 15 s/b: dog.setName("Aiko");

216....bug.......Starting at 2nd sentence "As we'll cover..." remove that sentence and the code down to the next heading.

233....bug.......In table 3-3, valueOf for Boolean does not throw NFE

234....bug.......1st two S.o.p.'s s/b: ("y = " + y);

236....clarify...Sentence before bullet points s/b: In order to save memory, two instances of the following wrapper objects, created through autoboxing, will always be equal...

236....clarify...Add this sentence: When == is used to compare a primitive to a wrapper object, the wrapper object will be unwrapped to its primitive value, and the comparison will be made between the two primitives' values.

258....clarify...2nd boxing bullet s/b: Using == with wrappers created through autoboxing is tricky; those with small values...

259....clarify...Q-2: code s/b: Short story = 200;
& 266

322....clarify...Near the bottom of the exam watch, sentence s/b: But the only variables that can be assigned (rather than tested against something else) are a boolean or a Boolean; all other...

364....typo......code: doStuff() s/b: doStuff();

370....x-ref.....3rd row (IllegalArgumentException) s/b: (This chapter)
.................6th row (NumberFormatException) s/b: (Chapter 3, "Assignments")

381....bug.......code s/b:

switch(x) {
case 2: y = 3; break;
case 3: y = 9; break;
case 4: y = 27; break;
default: assert false; // we're never supposed to get here
}

439....bug.......2nd 2. s/b: Create a Writer or a Stream. Specifically, create a FileWriter, a PrintWriter, or a FileOutputStream.

454....bug.......2nd paragraph s/b: ...(unless you implement readObject())...

472....bug......."Finding stuff" bullet, last sentence s/b: We'll use the java.util.regex.Pattern , java.util.regex.Matcher, and java.util.Scanner classes to help us find stuff.

492....bug.......Last paragraph s/b: ...and to deserialize an object invoke readObject().

497....bug.......6th bullet: was matcher() s/b: matches()

505....typo......top of page: was: "dir1" and "dir1"
& 517.........................s/b: "dir1" and "dir2"

538....bug.......In figure, LinkedHashMap s/b a subclass of HashMap

562....bug.......After big code listing, s/b: ...not predictable: HashSets do not guarantee any ordering.

574....big bug...The top 2/3 of the page uses a HashSet / Set example. It should be using an ArrayList / List example, so replace 10 occurrences of "Set" with "List", and replace 2 occurrences of "HashSet" with "ArrayList".

581....clarify...Exam watch should be: ...even if that Object reference refers to an Integer (or some other wrapper object) on the heap.

620....bug.......Q-16: method declaration s/b:
& 634

public static <E extends Number> List<E> process(List<E> nums)

631....bug.......A-13, end of answer s/b: are not defined in the Arrays or Collections classes. (Objective 6.5)

711....x-ref.....item 5 s/b: ...Chapter 6...

783....clarify...Q-4, D. s/b: D. _A.
& 792

787....bug.......Q-10, This is really a question about java, not javac.
796 & 797........Change all references from javac to java.

[ April 16, 2006: Message edited by: Bert Bates ]

[ July 28, 2006: Message edited by: Bert Bates ]
[ July 28, 2006: Message edited by: Barry Gaunt ]
 
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 some more for your errata:

page 605: 2nd last sentence and page 610 4th point on allowing reading but no updating/modifying. This is not completely accutate as for example you can still use the Collection.clear() and Collection.remove(Object o) methods on a Collection referenced using a generic type with extends keyword.

page 646: Last sentence in last paragraph, method-local inner classes can also have the strictfp modifier.

page 649: Exam watch in parenthesis at end of paragraph, semicolon following curly braces also appears in constant specific class body of enums (and you can throw extra semicolons in anywhere in code between statements, methods, classes and enums (so these declarations are completely legal:
)).

page 682: Exam watch code example, cannot instantiate Runnable interface, change

to
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
what is s/b ???
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I believe s/b means "should be".
 
jay nair
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
240...bug...sentence after Byte, Byte answer s/b: any number of byte parameters.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
235...i++ s/b y++ ?
[ April 21, 2006: Message edited by: Dick Eimers ]
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Thank you
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I'm not sure if these are technically mistakes, but here are a few oddities I've noticed.

On page 69 - 70 deals with interface implementation, but there's no meaningful discussion of the topic until page 116 in the next chapter (chapter 2).

On page 227 the 2nd sentence of the objective says "Discuss the differences between the String, StringBuilder, and StringBuffer classes." There is no discussion of these classes in this chapter. It is discussed 3 chapters later in Chapter 6.

That's all I have for now.

I think the first one is a bigger problem, simply because it's reviewing a topic that wasn't covered (and had me scouring the chapter to find info that wasn't there).

Kevin
[ April 26, 2006: Message edited by: Kevin Crays ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have a question on page 2969, question 7. Correct answer is A, but I think is D:

1. class Zippy {
2. String[] x;
3. int[] a [] = {{1, 2}, {1}}
4. Object c = new long[4];
5. Object d = x;
6. }

I agree that all the cast are legal, BUT variable x was not initialized!
So, the code doesn't compile.

Bye,
Alberto
 
Alberto Cancello
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
page was 269.

Bye,
Alberto
 
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
Alberto,

This is not an error. I compiled the code myself, it compiles. They are all instance variables. I would recommend posting a new topic for feedback to this question.




Alberto Cancello wrote:
...but I think is...


For complete certainty in code samples, the best way to learn is to compile and run the samples yourself.

Kristian
[ April 27, 2006: Message edited by: Kristian Perkins ]
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
In reading chapter 2 of the SCJP Study Guide, I have found what I believe to be an error in the book, but just to make sure I'm not going mad, I'd thought I'd get a second opinion!

On pg 105 (table 2.1), the book mentions that it is illegal to have an overidden method throw IOException when the superclasses's method declaration throws Exception. This is not true surely??? A subclass can throw more specific checked exceptions than is declared by its superclass(es)!

Has anyone else spotted this particular inconsistency in the book?
 
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
Mark,

This is not an error. Table 2.1 refers to the code sample at the top of page 105 where the eat() method does not declare that is throws an exception, not the code in the exam watch on the previous page where the eat() method does declare that is throws an exception.

Kristian
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
In Chapter 8's review question number 9 we have the following code:



The question is "What is the result?" and amongst the possible answers are:
F. Compilation fails because of an error on line 8.
G. Compilation fails because of an error on a line other than 3, 4, or 8.

The problem with refering to specific lines is that the actual output from the compiler may vary and in this case (and perhaps with many others) you will get a different line number depending on whether there is a white space at the end of a line such as at line 7. If you add a space the compiler states the error is on line 8 instead of line 7 (verified on more than one platform).

I guess phrasing it "because of an error on line" makes it clear what the source of the error is (but one can also argue that it's the statement that starts on line 3 that caused the error) as opposed to what the compiler actually outputs.

Just thought this deserved a mention even though it may not be considered errata,
Dario
[ May 05, 2006: Message edited by: D Laverde ]
 
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 D -

Welcome to the ranch! A quick couple of things:

1 - Please change your display name to be a full first and last name, we've found it helps to keep things friendlier - Thanks!

2 - The wording of this question matches the wording on the exam if not exactly, very closely. It's definitely true that some of the wording on the real Sun exam is a little on the weird side, but we try to match it as closely as possible in our mocks. That way you'll be better prepared when you get to the real exam.

hth,

Bert
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
How does one review the correct answers to the exam on the accompanying CD? I completed the exam and was not able to view the answers. I could only see my score.

Also, is there a place to report errata for the CD? I think that there are at least two mistakes in the quiz on the CD. I contacted LearnKey and was told to contact Osbourne. I never got a response from them.

Thanks,
Steve
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Bert:

Can you check following places at your convenience:

1.p.27 Figure 1-2 con.goFast() uses R, while p.32 Figure 1-3 con.goFast uses I. The latter should be R
2.p.59 Volatile Variable paragraph: Chapter 11 changed to Chapter 9
3.p.421 last 2nd line: x+=" ocean" misses ;
4.p.463 within the 3rd paragraph: ... let's you add ... changed to ... let's add ...
5.p.528 2nd line: ... moofvalue() method, changed to ... getMoofValue() mehtod,
6.p.669 Answer of Self Test 8: A,C,D,E and F are incorrect ... changed to A, B, D, E and F are incorrect ...
7.p.684 Figure 9-1 map part: methodI() (or methodl()) changed to method1()
8.p.752 within Answer of Self Test 13: ... so it throws an IllegalThreadStateException. changed to ... so it throws an IllegalMonitorStateException
9.p.757 within Answer of Self Test 17: ... causes an IllegalThreadStateException, changed to ... causes an IllegalMonitorStateException,

Thx

[ May 03, 2006: Message edited by: Leigh Su ]
[ May 03, 2006: Message edited by: Leigh Su ]
 
Leigh Su
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Manuel Comnenus:
How does one review the correct answers to the exam on the accompanying CD? I completed the exam and was not able to view the answers. I could only see my score. Steve



Hi Steve:

Actually before you take Quiz or Exam, you can click OPTIONS button at the Main Menu, and change the options of Show Study Guides after each Question and Default mode for listing Study Guide. After you done the Quiz or Exam, you can show and save the Study Guide (include answer and explanation) as you selected. Do remember your answers won't be kept in the Study Guide, so write down your answers when you can see them.

When open the Study Guide, you can see Question n:m, the n replace the sequence of the question, the m replace the number at database (.dbf file).
If forget to save the Study Guide, you can still open the .dbf file using tools like Foxpro to see the answer and explanation in Ref field.

By the way, suggest LearnKey MasterExam to add a function like saving tester wrong answers with Study Guide or some file.

Originally posted by Manuel Comnenus:
Also, is there a place to report errata for the CD? I think that there are at least two mistakes in the quiz on the CD. I contacted LearnKey and was told to contact Osbourne. I never got a response from them.
Steve



I also haven't find the place yet.

Now post MasterExam 1 errata here: (number as showed in the database)
27 F A java.io.bufferedReader can be ... changed to A java.io.BufferedReader can be ...
74 G java -cp jars/cp.jar MusicPlayer changed to java -cp jars/mp.jar MusicPlayer because the question gives mp.jar
H java -cp /mp/jars/cp.jar player.MusicPlayer changed to java -cp /mp/jars/mp.jar player.MusicPlayer the same reason
[ May 04, 2006: Message edited by: Leigh Su ]
 
Manuel Comnenus
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Leigh,

Thanks. One thing that I noticed recently is that the LearnKey exam questions are either strikingly similar or the same as the quiz questions, so I am not sure how much value there is in completing the LearnKey exam anyway. The quiz questions, if I am not mistaken, are presented in random order if one retakes the entire set of quiz questions.

Steve
 
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
A little update on errata:

I just sent an updated list (including most of the additions in this thread) to the publisher - more news when I have it.

As far as this goes:

Manuel Comnenus

Thanks. One thing that I noticed recently is that the LearnKey exam questions are either strikingly similar or the same as the quiz questions, so I am not sure how much value there is in completing the LearnKey exam anyway. The quiz questions, if I am not mistaken, are presented in random order if one retakes the entire set of quiz questions.



Manuel, et. al., It's true that sometimes we used the same basic code to set up more than one question, but when we did that we were testing a different aspect of a topic. So, even if you see a question that looks familiar, there's almost certainly going to be a subtle difference that is testing a different bit of knowledge.

hth,

Bert
 
Manuel Comnenus
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Bert,

I was wondering if you are interested in errata related to the CD? I don't imagine that, at this date, I have discovered something that perhaps hundreds or thousands of others haven't already identified.

Thanks,
Steve
 
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
Yes, we're interested, and at the same time sad about :roll: , errata on the CDs.
 
Kevin Crays
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
So if I have


the output is
i = 1
i = 1

Nevermind the actual for loops read for (i=0; i < 1; i++); {....}
[ May 11, 2006: Message edited by: Kevin Crays ]
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Bert,

Page 229: Just before last code example. The constructors for Boolean wrapper take either a boolean value true or false , or a case-insensitive String with the value "true" or "false".
From the API:

Boolean
public Boolean(String s)Allocates a Boolean object representing the value true if the string argument is not null and is equal, ignoring case, to the string "true". Otherwise, allocate a Boolean object representing the value false. Examples:
new Boolean("True") produces a Boolean object that represents true.
new Boolean("yes") produces a Boolean object that represents false.


Parameters:
s - the string to be converted to a Boolean.


Therefore, any String which is not "true" can be passed to Boolean constructor and it will evaluate to a "false" value.

Regards,
Sumita.
[ May 10, 2006: Message edited by: Sumita Padiyar ]
 
Deepti Padiyar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Kevin,

The statement
"At the bottom of page 335 it says "evaluating the iteration expression and then evaluating the conditional expression are always the last 2 things that happen in a for loop." is very much true.


with the iteration expression occuring BEFORE the conditional expression. The basic way to work with for loops is as sollows:

1.Initialize first , so i=0
2.check the condn i<1 is true
3.go throught he loop , so prints oout i=1
4.evaluate iteration, i++, so i=1
5. check condition i<1 is false
6. so exit loop.

So from above,
"evaluating the iteration expression and then evaluating the conditional expression are always the last 2 things that happen in a for loop."

Regards,
Sumita.
 
Kevin Crays
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Sumita, thanks for the reply. In zeal to report a mistake, i missed a mistake

I had a rogue semicolon before the opening bracket. :roll:

I managed to miss that error (several times) before I reported it. I can't do that on the test
Thanks again.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Bert,

It seems to me that answer to Q.1 in Self Test (Chapter 10: Development in SCJP 5 Guide) is not accurately presented because compiling the second file i.e. Needy3.java does fail (so answer D is correct). However, the first place where it gets stuck is: that it couldn't find package xcom which isn't mentioned in the explanation. If that part is fixed by specifying correct classpath for Useful.java class at command line THEN compilation will obviously fail only because the increment() inside Useful.java class (coz its not visible outside its package).

With the current wordings of the question, are you assuming that student will compile class Needy3 by specifying correct classpaths in javac and java commands for class Useful? If that's true then your answer (i.e. option D) along with its explanation is correct, else the explanation doesn't seem 100% correct to me as mentioned in the paragraph above.

---------------
Ravinder Singh
 
Kevin Crays
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Dupe. Not sure how that happened.
[ May 26, 2006: Message edited by: Kevin Crays ]
 
Kevin Crays
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
As mistakes go, this is incredibly minor, but from page 450:

The two special methods you define must have signatures that look EXACTLY like this:


2 things. The first is that os almost certainly was supposed to be is. The second is that the emphasis on EXACTLY makes it sound like you're saying the var names might actually matter (they shouldn't and as far as I know they don't).

Another error on the bottom of page 465:




which our JVM produces [among other things]

parsed = Sat Sep 08 00:00:00 MDT 2001

Notice that because we were using a SHORT style, we lost some precision when we converted the Date to a String



This is incorrect. THe reason we lost precision (which refers to the time, AFAIK), is because we used the getDateInstance method to get the date instead of the getInstance method. Whether we use SHORT, FULL or no style at all, we still lose the original time of 19:46:40 MDT.

Hope this helps....hope I'm correct and they're really errors this time

[ May 25, 2006: Message edited by: Kevin Crays ]
[ June 05, 2006: Message edited by: Kevin Crays ]
 
Dick Eimers
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
217 myDogs(0) s/b myDogs[0]
 
Dick Eimers
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
584 "For example, imagine a classic (simplified) polymorphism example of a veterinarian (AnimalDoctor) class with a method checkup()." s/b "For example, imagine a classic (simplified) polymorphism example of a veterinarian (AnimalDoctor) class with a method checkAnimal()."

642 see this thread

The amount of errors in this book is starting to annoy me. I've paid 60 euros -- about 70 dollars-- for this book and it is packed with errors.
[ June 05, 2006: Message edited by: Dick Eimers ]
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by Dick Eimers:

The amount of errors in this book is starting to annoy me. I've paid 60 euros -- about 70 dollars-- for this book and it is packed with errors.


Compared to the fifth edition of the Heller and Roberts book (absolute crap IMHO) the K&B book is fantastic!!!

I'd rather have some typos compared to having critical exam objectives totally ignored
 
Kevin Crays
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Here's another mistake;

On page 65 the enum example (CoffeeSize) has the following:



Again this is misleading. A semicolon always follows the last enum, whether it has a body or not.

If the body had instead been for Big or Huge, we would have had a comma after the body.

Definitely misleading and might have missed it if I wasn't trying to find an overly complex solution to a simple problem

Kevin

[ June 05, 2006: Message edited by: Kevin Crays ]

[ June 12, 2006: Message edited by: Kevin Crays ]
[ June 12, 2006: Message edited by: Kevin Crays ]
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Kevin,

The body here meant the enum body after all the enum constants( enum's constructor and/or methods), not the body for the enums themselves.
I wasn't misled when I came through it. and if you don't have enum bodies after the last enum constant, you don't have to put a semicolon after the last.

But of course you are right saying after the not-last constant, it is always comma.
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
On Page 61, the following was mentioned:

"The key point to remember is that the enum can be declared with only the public or default modifier, just like a non-inner class."

This is not true because you can have static, protected, and private modifiers applied to enum types in a class. I think there is a small typo mistake because the sentence above should be as follows:

"The key point to remember is that the enum that isn't enclosed in a class can be declared with only the public or default modifier, just like a non-inner class."
[ June 05, 2006: Message edited by: Firas Zureikat ]
 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I think I am sure of this one:

Page 665. Self Test Answers. Qn1.

This is wrong: "C is incorrect because it uses incorrect syntax. When you instantiate a nested class by invoking new on an instance of the enclosing class, you do not use the enclosing name"
This is equivalent to say:
MyOuter.MyInner mi = m.new MyInner(); is correct. But it doesn't compile at all.

So the thing is, you can not invoke new on an instance of the enclosing class AT ALL, when u wanna construct a static nested class object, no matter how. I've tried it.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I am preparing for the exam and I've found something what I believe is an error.
At the bottom of the page 507, answer F: "... you would override the readObject() method in SpecialSerial". At the answers section this statement is claimed to be correct, which is strictly speaking not true. This method is not overriden in any sense. You can even use private access modifier for the readObject method - it really doesn't matter. And what you have taught us about private methods and overriding?
[ June 09, 2006: Message edited by: Kanstantsin Baturytski ]
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
The word "override" should probably be replaced by "implement", as we are talking here about special callback system provided by serialization in java. Refer to page 450, top of page.
 
Kevin Crays
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator

Originally posted by warren li:
Kevin,

The body here meant the enum body after all the enum constants( enum's constructor and/or methods), not the body for the enums themselves.
I wasn't misled when I came through it. and if you don't have enum bodies after the last enum constant, you don't have to put a semicolon after the last.

But of course you are right saying after the not-last constant, it is always comma.



Hmmm...I guess that's correct. I thought the semicolon was required for any Enum with an argument, because AFAIK, the book doesn't say that it is optional, while it does state that for other places (such as at the end of the enum body). The example at the bottom of page 63 implied to me that it was required.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic