These are the errors that have been brought to our attention since publication of the third edition. If you find an error in the text or just wish to make a suggestion for improving the text, please email us at: ralph.morelli@trincoll.edu. We will acknowledge any contributions we receive on this page.
Page 133: - In Figure 3.17:
Replace Scanner sc = Scanner.create(System.in)
With Scanner sc = new Scanner(System.in)
Page 137: - In Figure 3.19:
Insert a left brace ({) after public class DrawSticksApplet extends Applet
Page 143: - Change Exercise 3.3(c) to:
If b1 is false, then if b2 is true, then print "one"; otherwise,
print "two"; otherwise print "three".
page 172, In Figure 4.20, the Greeter() referred to on line 10 is defined as follows:
public class Greeter {
public String greet(String name) {
return "Hi " + name + " nice to meet you.";
}
}
Page 173, at the top of the page,
Delete as illustrated in Figure 4.8
Change (Fig. 4.2) with (Fig. 4.8)
Page 175, Figure 4.21 - Insert the following statement at beginning of the buildGui() method
setLayout(new BorderLayout());
Page 185, Figure 4.28
Replace
fileScan = fileScan.useDelimiter("\r\n");
With
fileScan = fileScan.useDelimiter("\n");
Page 189, In Solution 4.3
Replace the colon (:) in line 15 with a semicolon (;).
Insert a semicolon (;) at the end of the third line from the bottom.
Page 190: - Change Exercise 4.4 to:
Arrange the AWT and Swing subclasses of the Component class used
in this chapter into their proper hierarchy, using the Object class
as the root of the hierarchy.
Page 192: - In the last sentence of Exercise 4.20:
Replace JButton()'s with JButton's
Page 240: - In Solution 5.16, the kb methods should be used as follows:
public class KBTestOneRowNim
{
public static void main(String argv[])
{ KeyboardReader kb = new KeyboardReader();
OneRowNim game = new OneRowNim(11);
while(game.gameOver() == false)
{ kb.prompt(game.report()); // Prompt the user
kb.prompt("You can pick up between 1 and " + OneRowNim.MAX_PICKUP + " :");
int sticks = kb.getKeyboardInteger(); // Get move
game.takeSticks(sticks); // Do move
System.out.println();
} // while
kb.display(game.report()); // The game is now over
System.out.print("Game won by player ");
System.out.println(game.getWinner());
} // main()
} // KBTestOneRowNim
Page 246: - In the third sentences of Exercises 5.25 and 5.27:
Replace applet with GUI
Page 277, Figure 6.12: - In main() method:
Replace Average avg = new Average()
With Validate avg = new Validate()
Page 301: - In the last sentence of Exercise 6.24:
Replace Uses with Use
Pages 328-329: - Replace all occurrences of Button with JButton
Page 344: - In the last sentence of Exercise 7.10:
Replace TextArea with JTextArea
Page 363: - In the second sentence of Subsection 8.3.2:
Replace
An interface cannot contain instance variables.
with
All variables of an interface are implicitly assumed to be static final.
Page 344: - In Exercise 8.9:
Replace TextArea with JTextArea
Page 448-449: - In Figure 9.32 and other code snippets:
Replace all occurrences of submitUserMove() with move()
Page 451: - In the displayed main() method near the bottom of the page:
Replace
game.addPlayer(new WordGuesser((WordGuess)game, 1, Player.COMPUTER);
game.addPlayer(new WordGuesser((WordGuess)game, 2, Player.COMPUTER);
with
game.addPlayer(new WordGuesser((WordGuess)game, 1, Player.COMPUTER));
game.addPlayer(new WordGuesser((WordGuess)game, 2, Player.COMPUTER));
Page 461: - In Solution 9.7:
Replace fileScan = Scanner.create(theFile);
With fileScan = new Scanner(theFile);
Page 468: - Two typos in Exercise 9.25:
Replace TextField with JTextField
Replace TextArea with JTextArea
Page 509: - In Exercise 10.18:
Replace Fig. 9.15 with Fig. 9.13
Replace InsertionSort() with insertionSort()
Page 601: - In Exercise 12.24:
Replace move(3, "A", "B","C") with move(3,'A','B','C')
Page 705: - Delete the last sentence of Exercise 14.18:
Have the horses implement the Drawable interface introduced in Chapter 8.
Page 794: - In Figure 16.31:
Replace
// new ArrayList?PhoneRecord?(); could also be used.
with
// new ArrayList
Page 797: - In Figure 16.33:
Replace
// new HashSet?PhoneRecord?(); could also be used.
with
// new HashSet
Page 798: - In Figure 16.35:
Replace
// new HashMap<K,V>(); could also be used.
with
// new HashMap<String,String>(); could also be used.
Page 830: In the second to last line:
Replace ^^ with ||