Errata for "Introduction to Java Programming, Third Edition" (1st, 2nd, and 3rd printing)
Chapter 1
Page 12, Delete the line "JFactory by Rouge Wave (www.rougewave.com)"
Chapter 2
Page 48, Before the NOTE, should be "The Math class is introduced in Chapter 4, "Methods."
Page 45, line 2-3. Should be "(width > 1) || (height == 2) is true because (height == 2) is true.
Chapter 3
Page 63, "syntax error" in the first TIP box should be "mistake".
Chapter 4
Page 104, Figure 4.5, n2 should be 1 after Swap.
Page 105, The last statement before Example 4.3 should be "The Java compiler determines which method is used based on the method signature."
Page 108-110. The approximation formula is not good. Here is the complete new Example at www.cs.armstrong.edu/liang/intro3e/Example4_4.html.
Page 121, Figure 4.16, the screen shot of the DOS output shows "...index 5 is 8" and "...index 10 is 89", It should be Index 5 is 5, and index 10 is 55.
Page 122. Line 9, "return 1" should be "return n". In Figure 4.17, fib(0) = 1 should be fib(0) = 0.
Page 131. Exercise 4.3, futureInvestmentValue(10000, 0.05, 5) should be futureInvestmentValue(10000, 0.05/12, 5).
Chapter 5
Page 148, Delete "In programming terminology, this is referred to as pass by reference" before Example 5.3. Java uses just one mode of passing parameters, i.e. pass by value. When an object is passed to a method, its reference value is passed.
Page 161, "This is illustrated in Figure 15.15" should be "This is illustrated in 5.15."
Chapter 6
Page 212, Rewrite the first paragraph in the Section, "Polymorphism and Dynamic Binding," as follows:
An object of a subclass can be used by any code designed
to work with an object of its superclass. For example, if a method expects a
parameter of the GeometricObject type, you can invoke it with a Circle object. A
Circle object can be used as both a Circle object and a GeometricObject object.
This feature is known as Polymorphism (a Greek word meaning “many forms.”) A
method may be defined in a superclass, but is overridden in a subclass. Which
implementation of the method is used on a particular call will be determined
dynamically by the JVM at runtime. This capability is known as dynamic binding.
Dynamic binding works as follows. Suppose an object o is
an instance of classes C1, C2, ..., Cn-1, and Cn, where C1 is a subclass of C2,
C2 is a subclass of C3, ..., and Cn-1 is a subclass of Cn. That is, Cn is the
most general class and C1 is the most specific class. In Java, Cn is the Object
class. If o invokes a method p, the JVM searches the implementation for this
method p in C1, C2, ..., Cn-1 and Cn, in this order, until it is found. Once an
implementation is found, the search stops and the first found implementation is
invoked.
Page 221, Figure 6.9 should be as follows:
Page 739, the first figure should be replaced by the previous figure.
Page 222, Delete the second sentence in the second bullet at the top of the page.
Chapter 7
Page 251, 3 lines before Figure 7.5, remove return -1 Page 345; 5 lines before the same figure, remove if (key > list[mid]), delete the last paragraph in this page.
Page 259, in the multiplyMatrix method, "new int[m1[0].length][m2.length]" should be "new int[m1.length][m2[0].length]".
Chapter 9
Page 345, change frame.pack in the main method to frame.setSize(200, 200).
Page 376, The if statement is messed up on top of the page, pls see the ButtonDemo.java on the CD-ROM or http://www.cs.armstrong.edu/liang/intro3e/book/ButtonDemo.java.
Chapter 12
Page 535, line -9 , Res s/b MyResource_fr
Page 535, line -22, Res s/b MyResource
Appendix I
Page 750, the caption of Figure I.2 should be "The JBuilder project pane holds manages the files in the project."
Index
Page 775, index, left column, line 13, missing ^ for (exclusive or), 44
Chapter 4
Page 131. Bob Noble pointed out an error in Exercise 4.3, futureInvestmentValue(10000, 0.05, 5) should be futureInvestmentValue(10000, 0.05/12, 5).
Chapter 7
Page 275, Professor Vidrine of George Washington University points out that several method names are incorrect:
vector.insertElement (anObject, 4); should be vector.insertElementAt (anObject, 4);
vector.setElement (anObject, 4); should be vector.setElementAt (anObject, 4);
vector.removeElement (4); should be vector.removeElementAt (anObject, 4);
Chapter 10
Page 463, Before Example 10.11, delete "The fill and anchor parameters are class variables, whereas gridx, gridy, gridwidth, gridheight, weightx, and weighty are instance variables." (10/28/02)
Chapter 11
Page 500, insert the following before 11.18.
In the following questions, assume that the divide method in Rational
is defined as follows:
public Rational divide(Rational secondRational) throws
Exception
{
if (secondRational.getNumerator() == 0)
throw new Exception("Divisor
cannot be zero");
long n = numerator*secondRational.getDenominator();
long d = denominator*secondRational.getNumerator();
return new Rational(n, d);
}