Corrections for the Fourth Edition

Data Structures and Other Objects Using Java (Fourth Edition)
by Michael Main
ISBN 0132576244


Pages 14 and 15:
The two uses of println should both be printf.
Page 34
java.math.abs should be java.lang.Math.abs.
Page 84:
Last paragraph has a statement "It might be better if the actual return type of the clone method was Location rather than Object…." This applies to older versions of Java. Our new code for the clone method does indeed have a return type of Location.
Page 113:
Problem 9 asks what kind of exception will be thrown by the code snippet, but this is actually a compile-time error, because b has not been initialized.
Page 237:
Since Java no longer requires the clone() method to return an Object, it would be preferable for DoubleLinkedSeq.clone() to return a DoubleLinkedSeq.
Page 258:
Near the bottom the text starts to talk about replacing Integer with Character. Thus, the line of code (the method header) is supposed to have Integer replaced with Character already. Otherwise it looks just like the code above.
Page 263:
There's a stray L in the code block.
Page 282:
In the first code block there are two extraneous semicolons.
Page 283:
public class Node should be public class Node
Page 316:
This is a printing problem, but in the stack of three books, the titles on the spines are not legible. The titles, from the top, should be: NOVEL, Thesaurus, and Dictionary.
Page 333:
The text states that in the case of a division by 0, the program throws an IllegalArgumentException in the evaluateStackTops method. This is not true. A division by zero using doubles results in an infinity value, which is stated in the comments in the code on the previous page.
Page 341:
The text mentions an ObjectStack, but this should be ArrayStack.
Page 398:
Problems 20 and 21 are duplicate. Please delete one of them.
Page 479:
The learn method header is missing the generic type after BTNode.
Page 703:
It would be better to use ArrayList instead of Vector, since Vector is now an obsolete collection.
Page 809:
The correct output from the statement printf("%(d", -42) is (42). It prints negative numbers in accounting style, using a set of parentheses around the number instead of a negative sign.
If you spot any more bugs, I'd be delighted to hear from you! Thanks.
--Michael Main (main@colorado.edu)