Java Gently 3rd edition
28 January, 2001
Misprints in a book as complex as this one occur in many ways. None of the errors found so far is serious. I have grouped them under headings to make it easier to understand them. Cosmetic typesetting changes in the text which may be made in future printings are omitted from this list altogether.
Residual use of the Text class
In the first and second editions, input and output were achieved through a class called Text. This class is now deprecated in the javagently package and replaced by a thoroughly object-oriented one called Stream. In the places below, Text still occurs. These programs would still compile and behave normally, but the intention was to standardise on Stream. The online example files have been changed to all refer to Stream, and the following corrections should accordingly be made in the book:
p369 lines 1, 2, 3 and 13
replace Text.readChar(fin) by fin.readChar() and so on
p183 line 17, p188 line 11, p581 line 1
replace Text.format by Stream.format
p194 line –15
replace the complex reference to a gameDisplay by
p223 lines –13 and –18
replace Text.writedouble and Text.format by Stream.format
Errors in the Quiz questions and answers
There are a few inconsistencies here, and they are explained and corrected in the online quizzes.
The switch statement
On page 184, the form does not explain what happens when there is no default case and the switch expression evaluates to a value which is not listed. In this instance, Java immediately exits the switch-statement, and there is no effect.
Changes in programs
p63 LotasaLabels Both the constructor and its call in main should be the same identifier as the class, i.e. LotsaLabels. They are incorrectly printed as DisplayWarning.
p146-147 PartCodes – This is the second PartCodes program, so in order to distinguish it in the online files from the other one, it is now called PartCodesMany. The class id, constructor id and call to the constructor should reflect this change. This is not strictly speaking an error, just a tidying up of names of files.
p174 CurioStore3 There is a little confusion with the name of the variable CurioSold. Strictly speaking, it should start with a small letter, abnd curiosSold makes more sense. This change has been made in the online version.
p298 The program does not ask for dates for Italy, which are shown in the output. The two statements have been added to the online version.
p188 Exchange rates for the curio store. The do loop needs to end when a symbol has been read, so the assignment on line 2 should read symbolRead = true;
p209 To refer back correctly to the program in example 6.1, the excerpt under Length should be scoreFreqs.length not frequency.length.
That’s it on 28 January 2001
Judith Bishop, Author