Java: An Introduction
to Computer Science and Programming
Second Edition

by Walter Savitch

2001 Prentice Hall, Inc.

Minor typographical errors whose corrections are obvious have not been given here.

page 48, Programming Exercise 2:
Delete the line:
totalNumberOfClams = numberOfApples * clamsPerApple;

page 108, fourth line from bottom:
Change "String" to "int" so the line reads as follows:
"is an assignment statement that sets the value of the int variable appleCount to"

page 207, Programming Exercise 7:
Change first line of exercise by changing "problem 7" to "problem 9"

page 253, Display 4.11 (part 1 of 3), the method setPrice:
Change "groupCount" to "count" throughout. (Four changes, including one in the header comment and one in the parameter list.)

page 278, if-else-statement just before Self-Test Questions:
Change "speciesName" to "getName."

page 321, eighth line down:
Delete the word "static." (The method is not static.)

page 373, answer number 21:
change "private" to "public" in the definition of the method write.

page 377, Programming Exercise 6:
Change "Programming Exercise 3/page 175" at the end to "Chapter 3 Programming Exercise 6/page 206."

page 378, Programming Exercise 7, ninth line from the bottom:
Add the word "one" so it reads:
"reset methods (one to set the value, one to set the type, and one to set both);"

page 387
System.out.println("The second entry is " + entry[2]);
entry[2] is actually the third entry. There are two more output statements on the same page with the same mistake.

page 447, Chapter Summary:
One entry is repeated.

page 1024:
The text at the top of the page says "In Java, n = 42 does not return a value."
This is incorrect. In Java, the assignment operator returns the value of the right-hand side, so n = 42 returns 42. A possible rewording would be:
"In C and C++ the expression n = 42 returns the value 42, which either is or will be converted to a boolean value depending on what version of C or C++ you are using. In Java, n = 42 also returns the value 42, but 42 is not of type boolean in Java nor will it convert to type boolean. So, in Java, this mistake will produce a compiler error message. (See page 168 for more details.)"
October 19, 2002