博客已转到HuJinPu 's blog

http://blog.csdn.net/hujinpu

首页 新随笔 联系 聚合 管理
  24 Posts :: 0 Stories :: 25 Comments :: 0 Trackbacks

Seventh Edition Volume 1 (JDK 5.0)

[2] Page xvi
In the seventh line from the bottom, change "bugs fixes" to "bug fixes".
[6] Page 18
Change "You can download them from http://www.phptr.com/corejava." to "You can download them from http://horstmann.com/corejava."
[4] Page 25
In the NOTE, change "Environnment" to "Environment".
[6] Page 36
Change “it simply displays the string We will not use 'Hello, World'!” to “it simply displays the string We will not use 'Hello, World!'” (i.e. move the ! inside the quotes to match the program at the top of the page)
[5] Page 40
After "..you use a p, not an e, to denote the exponent." add: "The exponent is specified in decimal and denotes a power of two."
[4] Page 41
Change "an unused 2048 byte-range" to "a range of 2048 unused values"
[6] Page 56
Change "Point your web browser to the docs/api/index.html subdirectory of your JDK installation." to "Point your web browser to the index.html file in the docs/api subdirectory of your JDK installation."
[6] Page 62, 123, 125, 465, 629, 630, 631, 640, 641, 642, 649, 681,
Change "Boolean" to "boolean" (in monospace)
[5] Page 62
Remove the line "^ Converts to upper case 0XCAFE". (This option was present in the Java 5 release candidate, but it was later dropped.)
[6] Page 63
Change "You use two a two-letter format..." to "You use a two-letter format..."
[4] Page 64
Last line of Table 3-7 (continued): Change E to Q.
[2] Page 80 BigIntegerTest.java line 8
Change Scanner.create to new Scanner
[4] Page 85
Change System.out.print(" " + a[i]); to System.out.print(" " + args[i]);
[4] Page 86
Change "Initially that is just r itself, but ..." to "Initially that is just r + 1, but..."
[4] Page 89 CompoundInterest.java line 5
Change final int STARTRATE to final double STARTRATE
[6] Page 95
Change "Encapsulation (sometimes called data hiding) is a key concept in working with objects. Formally, encapsulation is nothing more than combining data and behavior in one package and hiding the implementation of the data from the user of the object." to "Encapsulation (sometimes called information hiding) is a key concept in working with objects. Formally, encapsulation is nothing more than combining data and behavior in one package and hiding the implementation details from the user of the object."
[4] Page 95
Change "When you invoke a message on an object" to "When you invoke a method on an object"
[6] Page 96
Change "Thus, a class depends on another class if its methods manipulate objects of that class." to "Thus, a class depends on another class if its methods use or manipulate objects of that class."
[4] Page 104-106 CalendarTest.java
The program prints an unsatisfactory calendar in locales whose first day of the week is not Sunday. (In most parts of the world, the first day of the week is considered Monday--after all, Saturday and Sunday are the weekend.) The following changes take care of this:
  • Remove the header SunMon Tue Wed Thu Fri Sat on page 104
  • In the program listing, replace lines 18 and 19 with
     // get first day of week (Sunday in the U.S.)
    int firstDayOfWeek = d.getFirstDayOfWeek();
  • In lines 22 and 49, replace Calendar.SUNDAY with firstDayOfWeek
  • Add the following four lines before the } in line 44. (The first line is blank)

    // start a new line at the start of the week
    if (weekday == firstDayOfWeek)
    System.out.println();
  • Remove lines 36 through 39
[4] Page 105
Change "For each day, we print a space if the day is < 10, then the day, and then a * if the day equals the current day." to "The current day is marked with a *."
[6] Page 106
In the Note, remove "and the hard-wired assumption that the week starts on a Sunday"
[6] Page 121
Change "demonstate" to "demonstrate"
[6] Page 128, 129
Change "Booleans" to "boolean values" (note monospace)
[6] Page 135
Remove the sentence "The sole purpose of package nesting is to manage unique names."
[6] Page 141
Change "Recall that you can import public classes only from other packages." to "Recall that you can import only public classes from other packages."
[4] Page 141
In the third line from the bottom, change "packages" to "package".
[4] Page 143
In the last line, change "set the warning border" to "set the warning string".
[6] Page 147
Change "If you like, you can place hyperlinks to other classes or methods anywhere in any of your comments." to "If you like, you can place hyperlinks to other classes or methods anywhere in any of your javadoc comments."
[6] Page 156
Remove "(that is, when i is 1 or 2)" and "(when i is 0)" , so that the remaining clause is "either Employee or Manager".
[6] Page 165
Change "In particular, move common fields and methods (whether abstract or not) to the abstract superclass." to "Move common fields and methods (whether abstract or not) to the superclass (whether abstract or not)."
[6] Page 172
In the numbered list, add 3. before "Compare the classes of this and otherObject." Increment the following numbers.
[4] Page 172
Remove "Judging from this evidence. . ." until the end of the note.
[4] Page 173
In Table 5-1, change the Hash Code column from 140207504 / 140013338 / 884756206 to 69609650 / 69496448 / -2141031506
[4] Page 174
In Table 5-2, change 3030 to 2556 (2x)
[6] Page 179
Change the last word on the page from "classed" to "called"
[6] Page 180/181
Change "relocation/tions/ting" to "reallocation/tions/ting" (3x)
[6] Page 181
Change "(This is different from, and, of course, never larger than, the array list’s capacity.)" to "(This is of course never larger than the array list’s capacity.)"
[6] Page 188
Change "returns a new Integer object initialized to the integer’s value, assuming the specified String represents" to "returns a new Integer object initialized to the integer whose digits are contained in the string s. The string must represent" (2x)
[4] Page 189
Change
System.out.printf("%d %d", new Object[] { new Integer(d), "widgets" } );
to
System.out.printf("%d %s", new Object[] { new Integer(n), "widgets" } );
[6] Page 191
Remove "We discuss reflection in the next section."
[6] Page 198
Change the last line from
while (cl != Object.class);
to
while (cl != null);
[6] Page 199
Remove line 3 (import java.text.*;)
[6] Page 201
Change "arrayCopy" to "arraycopy"
[6] Page 203/204
Change "fundamental" to "primitive" (2x)
[4] Page 206
Change
System.out.printf("%10.4f | %10.4f%n" + y, x, y);
to
System.out.printf("%10.4f | %10.4f%n", x, y);
[4] Page 207
Remove code lines 42 and 43.
[4] Page 215
Change the first java.lang.Comparable API header to java.lang.Comparable<T>. Remove the second java.lang.Comparable<T> header.
[4] Page 220 and 221
In the clone methods, change
return super.clone();
to
return (Employee) super.clone();
Page 221
Change
public Object clone() throws CloneNotSupportedException
to
public Employee clone() throws CloneNotSupportedException
[6] Page 228
Change “Because the TalkingClock defines no constructors” to “Because the TimePrinter class defines no constructors”
[4] Page 231
In the NOTE, change
java ReflectionTest 'TalkingClock$TimePrinter'
to
java ReflectionTest TalkingClock\$TimePrinter
(that is, remove the quotes and add a backslash). Both methods work, but the change matches the preceding text.
[6] Page 233
Change “Note that the TimePrinter class no longer needs to store a beep instance variable. It simply refers to the parameter variable of the method that contains the class definition.” to “Note that the TalkingClock class no longer needs to store a beep instance field. The actionPerformed method of the TimePrinter class simply refers to the beep parameter variable of the start method.”
[4] Page 233 (2x) and 235 (1x)
Change
Timer t = new Timer(1000, listener)
to
Timer t = new Timer(interval, listener)
[4] Page 254
Change /**import java.awt.* to import java.awt.*
[6] Page 251
Change frame.show(); to frame.setVisible(true);
[4] Page 330
In the API note for getActionMap, change "keystrokes to action keys" to "arbitrary objects to Action objects".
In the API note for getInputMap, change "action keys to action objects" to "keystrokes to arbitrary objects"
[4] Page 330
Change released ctrl Y to ctrl released Y
[4] Page 343
Change "Each user interface has a wrapper class..." to "Each user interface component has a wrapper class...".
[4] Page 349
Change "Finally, you add the individual buttons" to "Finally, you add the panel"
[4] Page 349
The word add in "using the add method you have seen before" is in the wrong font.
[4] Page 353
In the first API note, change int cols to int columns
[4] Page 360
Remove code lines 66 - 68
[4] Page 400
Change the four code lines starting with
JSpinner timeSpinner
to
JSpinner timeSpinner = new JSpinner(new 
      SpinnerDateModel(new Date(), null, null, Calendar.HOUR)
      {
         public void setCalendarField(int field) {}
      });

[4] Page 402
Change code lines 75 - 78 to
      JSpinner timeSpinner = new JSpinner(new
            SpinnerDateModel(new Date(), null, null, Calendar.HOUR)
            {
               public void setCalendarField(int field) {}
            });

[4] Page 405
In the explanation for the maximum parameter of the javax.swing.SpinnerDateModel constructor, change "The maximum valid value, or null if no lower bound..." to "The maximum valid value, or null if no upper bound..."
[4] Page 412
In the second line from the bottom, change JPopup to JPopupMenu.
[4] Page 422
Below line 28, add a line
add(panel, BorderLayout.CENTER);
[4] Page 432
Change
panel.add(style, bold);
to
panel.add(component, constraints);
[6] Page 443
The bulleted list is wrong (with different errors in two printings). Here is the correct version:
  • Connecting the west side of the component with the west side of the container;
  • Traversing the width of the component;
  • Connecting the east side of the component with the west side of the container.
[4] Page 444
Change
Spring.max(layout.getConstraints(faceLabel).getWidth(),
Spring.max(layout.getConstraints(sizeLabel).getWidth()));
to
Spring.max(layout.getConstraints(faceLabel).getWidth(),
layout.getConstraints(sizeLabel).getWidth()));
(i.e., remove the second Spring.Max()
[4] Page 447
Change "...to the given side of the start container" to "...to the given side of the startcomponent"
[4] Page 457
Change "The icon is a warning icon" to "The icon is a question icon". Change WARNING_MESSAGE to QUESTION_MESSAGE
[6] Page 509
Change “NOTE: The strings used when you define the parameters with the param tag and those used in the getParameter method must match exactly. In particular, both are case sensitive.” to “NOTE: A case-insensitive comparison is used when matching the name attribute value in the param tag and the argument of the getParameter method.”
[6] Page 522, 524
Change
public Enumeration getApplets() { return null; } 
to
public Enumeration<Applet> getApplets() { return null; } 
and
public Iterator getStreamKeys() { return null; }
to
public Iterator<String> getStreamKeys() { return null; }
[6] Page 547
Change
defaultSettings.put("color.red", "0 50 50");
to
defaultSettings.put("color.red", "0");
[4] Page 567
Change se.setCause(e) to se.initCause(e)
[4] Page 571
Change the numbers after StackTraceTest.java: from 8 23 / 8 14 23 / 8 14 14 23 to 17 33 / 17 23 33 / 17 23 23 33
[6] Page 602
Change
java -Dcom.sun.management.jmxremote MyProgram.java
to
java -Dcom.sun.management.jmxremote MyProgram
[6] Page 604
Change void addXxxListener(XxxEvent) to void addXxxListener(XxxListener).
[4] Page 615
Change "displays all instance fields of the evt variable" to "displays all instance fields of the event variable"
[4] Page 630
In the second line of Table 12-2, change b17a16a15... to b17b16a15...
[6] Page 632
Change “The advantage of having the RandomAccessFile class implement both DataInput and DataOutput is that this lets you use or write methods whose argument types are the DataInput and DataOutput interfaces.” to “The RandomAccessFile class implements both DataInput and DataOutput. It is a good idea to use these interfaces for method parameters.”
[4] Page 634
Change Set<String, CharSet> to Map<String, CharSet>.
[5] Page 639
In the API description for CharBuffer decode(ByteBuffer buffer), change "decodes the given character sequence ..." to "decodes the given byte sequence"
[4] Page 658
In the second line from the bottom, change long int nbytes to long nbytes.
[4] Page 660
Lines 76, 77 of the code should be
      Raises the salary of this employee.
      @param byPercent the percentage of the raise

[4] Page 667
Change "The java.util.Date class defines its own readObject/writeObject methods" to "The serializable java.util.Date class defines its own writeObject method". (The wording in the book was correct, but it confused some readers into thinking that Date is externalizable.)
[4] Page 688
In the documentation for createNewFile, change "automatically creates" to "atomically creates".
[4] Page 713
In the second line of the section Generic Code and the Virtual Machine, change "was even able compile" to "was even able to compile".
[4] Page 719
In the third line from the top, change new Pair<String>(10) to new Pair<String>[10]
[4] Page 720
In the tenth line from the bottom, change
								Pair<Employee> = ArrayAlg...
						
to
Pair<Employee> result = ArrayAlg...
[6] Page 723
Change
void set(? super Manager)
? super Manager get()
to
void setFirst(? super Manager)
? super Manager get
First()
[6] Page 723
Change "with any Manager object (or a subtype such as Executive), but not with an Employee" to "with any value of type Manager, Employee, or Object, but not with a subtype value such as Executive."
[6] Page 726
Change “Of course, in this case, we were not compelled to use a wildcard—there is nothing wrong with using a type parameter, as in the swapHelper method.” to “Of course, in this case, we were not compelled to use a wildcard. We could have directly implemented <T> void swap(Pair<T> p) as a generic method without wildcards.”
[4] Page 735
Add an entry
enuman enumerated type3
[6] Page 743
Change "Boolean, 42, 46, 186, 735" to two entries "boolean, 42, 46, 735" and "Boolean, 186"
[6] Page 760
Change "true or false, seeBoolean" to "true or false, seeboolean"

Seventh Edition Volume 2 (JDK 5.0)

[3] Page xvii
In the second line from the bottom, change Example 5-8 to Example 5-12
[4] Page 3
Change "inside the move method of the Ball class." to "inside the addBall method of the BounceFrame class".
Page 12 BounceThread.java
Remove these lines:
203. public static final int STEPS = 1000;
204. public static final int DELAY = 3;
[3] Page 19
Change "of its parent thread, that is, the thread that started it" to "of the thread that constructed it"
[2] Page 30
Change "You must make sure that the thread cannot be interrupted between the test and the insertion." to "You must make sure that no other thread can modify the balance between the test and the transfer action."
[2] Page 40
Remove the first four lines after Synchronized Blocks "However, a Java object ... only one condition".
[2] Page 41
Apply boldface to synchronized (lock) and remove it from System.out.println(. . .)
[2] Page 42
Change $1,200 to $200 and $1,300 to $300
[2] Page 43
In Figure 1-6, change 1200 to 200 and 1300 to 300
[3] Page 49
Change "The call Object head = q.poll(...) returns true for 100 milliseconds ..." to "The call Object head = q.poll(...) tries for 100 milliseconds ..."
[2] Page 64
In the code just above the API notes, change taks.size() to tasks.size().
[4] Page 100
In the API notes for the remove method of java.util.List<E>, change "removes and returns an element at the specified position" to "removes and returns the element at the specified position"
[4] Page 100
In the API notes for java.util.List<E>, add the following before E set(int i, E element):
  • E get(int i)
    returns the element at the specified position.
[3] Page 130 Code line 98
Change
return offset < elements.length;
to
return offset < count; 
[4] Page 152, 153 ThreadedEchoServer.java
Remove lines 43, 86. Change the following lines:
22. Runnable r = new ThreadedEchoHandler(incoming);
44. public ThreadedEchoHandler(Socket i)
47. incoming = i;
[4] Page 166
In the API note of void setConnectTimeout(int timeout)/int getConnectTimeout(), change "...the read method of the associated input stream..." to "...the connect method of the associated input stream...". In the API note of void setReadTimeout(int timeout)/int getReadTimeout(), change "...the connect method of the associated input stream..." to "...the read method of the associated input stream...".
Page 175
The Scanner class wraps the InterruptedIOException. For greater clarity, change
Scanner in = new Scanner(s.getInputStream()); String line = in.nextLine();
to
InputStream in = s.getInputStream();// read from in
[2] Page 229
Change "gets a description of all tables in a catalog..." to "returns a description of all tables in a catalog..."
[2] Page 229
Change "The catalog and schema parameters..." to "The catalog and schemaPattern parameters..."
[3] Page 240
Change
stat.releaseSavepoint(svpt) 
to
conn.releaseSavepoint(svpt)
[2] Page 244
In the last two rectangles in the bottom row of Figure 4-9, change ou=people to ou=groups
[4] Page 281
Product.java is the wrong version. The companion code has the correct version, but it is too long to fit in its entirety. Use this abbreviated version:
import java.rmi.*;

public interface Product extends Remote
{ 
   /**
      Gets the description of this product.
      @return the product description
   */
   String getDescription() throws RemoteException;

   final int MALE = 1;
   final int FEMALE = 2;
   final int BOTH = MALE + FEMALE;
}
[4] Page 282
ProductImpl.java is the wrong version. The companion code has the correct version, but it is too long to fit in its entirety. Use this abbreviated version:
import java.rmi.*;
import java.rmi.server.*;

public class ProductImpl extends UnicastRemoteObject implements Product
{ 
   public ProductImpl(String n, int s, int age1, int age2, String h) throws RemoteException
   {  
      name = n;
      ageLow = age1;
      ageHigh = age2;
      sex = s;
      hobby = h;
   }

   public boolean match(Customer c)
   {  
      if (c.getAge() < ageLow || c.getAge() > ageHigh)
         return false;
      if (!c.hasHobby(hobby)) return false;
      if ((sex & c.getSex()) == 0) return false;
      return true;
   }

   public String getDescription() throws RemoteException
   {  
      return "I am a " + name + ". Buy me!";
   }

   private String name, hobby;
   private int ageLow, ageHigh, sex;
}
[3] Page 293
Change
name = (String) data.get();; 
to
name = (String) data.get();
[4] Page 294, 295
ProductImpl.java is the wrong version. The companion code has the correct version, but it is too long to fit in its entirety. Use this abbreviated version:
import java.io.*;
import java.rmi.*;
import java.rmi.activation.*;

public class ProductImpl
   extends Activatable
   implements Product
{ 
   /**
      Constructs a product implementation
      @param id the activation id
      @param data the marshalled construction parameter (containing the product name)
   */
   public ProductImpl(ActivationID id, MarshalledObject data) 
      throws RemoteException, IOException, ClassNotFoundException
   {  
      super(id, 0);
      name = (String) data.get();
      System.out.println("Constructed " + name);
   }

   public String getDescription() throws RemoteException
   {  
      return "I am a " + name + ". Buy me!";
   }

   private String name;
}
[4] Page 296
Change
static Remote register(ActivationDescriptor desc)
to
static Remote register(ActivationDesc desc)
[4] Page 311
Change
System.out.println(orb.object_to_string(impl));
to
System.out.println(orb.object_to_string(ref));
[2] Page 334
Remove the line
JLabel label = new JLabel();
[4] Page 391
Add return this; as the last line of getTableCellRendererComponent so that the code looks like this:
class ColorTableCellRenderer extends JPanel implements TableCellRenderer
{
   public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
      boolean hasFocus, int row, int column)
   {
      setBackground((Color) value);
      if (hasFocus)
         setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
      else
         setBorder(null);
      return this;
   }
}
[2] Page 425
Change "on the CD" to "in the companion code"
[3] Page 439
In Fig. 6-48, change the callout "minimize icon" to "maximize icon"
[4] Page 443
Change “The JDesktopPane class has no method to return the selected frame. Instead, you must traverse all frames ...” to “Traverse all frames ...”. (Actually, you can get the selected frame by calling JDesktopPane.getSelectedFrame, but we need its index.)
[4] Page 462
Change "... drawn by the CubicCurve3D class ..." to "... drawn by the CubicCurve2D class ..."
[3] Page 462
Change "between 2180 and 180" to "between -180 and 180"
[3] Page 664
Example 8-10: ChartBean2BeanInfo.java has the wrong file. The correct file is
package com.horstmann.corejava;

import java.awt.*;
import java.beans.*;

/**
The bean info for the chart bean, specifying the
icons and the customizer.
*/
public class ChartBean2BeanInfo extends SimpleBeanInfo
{
public BeanDescriptor getBeanDescriptor()
{
return new BeanDescriptor(ChartBean2.class, ChartBean2Customizer.class);
}

public Image getIcon(int iconType)
{
String name = "";
if (iconType == BeanInfo.ICON_COLOR_16x16) name = "COLOR_16x16";
else if (iconType == BeanInfo.ICON_COLOR_32x32) name = "COLOR_32x32";
else if (iconType == BeanInfo.ICON_MONO_16x16) name = "MONO_16x16";
else if (iconType == BeanInfo.ICON_MONO_32x32) name = "MONO_32x32";
else return null;
return loadImage("ChartBean2_" + name + ".gif");
}
}

[4] Page 705
Change http://bugs.sun.com/developer/bugParade/bugs/4030988.html to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4030988
[4] Page 772
Change
int outputSize= cipher.getOutputSize(inLength);
to
int outputSize= cipher.getOutputSize(blockSize);
[3] Page 788
In the fourth line from the bottom, change "the java.text class" to "the java.textpackage"
[3] Page 807
In the 4th line from the bottom (excluding the CAUTION note), change 10.0E7 to 10.0E8.
[4] Page 811
Change java -encoding Big5 Myfile.java to javac -encoding Big5 Myfile.java.
[2] Page 833
In line 17 of the code for HelloNative.h, change ifdef to #ifdef
[3] Page 836
Change
... a format string "%w.pf" ...
to
... a format string "%w.pf" ...
(w and p should be Roman italic)
[2] Page 861
Change
jint ThrowNew(JNIEnv *env, jclass clazz, const char msg[])
to
jint ThrowNew(JNIEnv *env, jclass cl, const char msg[])
[3] Page 878
Change GetSuperClass to GetSuperclass
[3] Page 927
Change "XML Style Sheet Transformations" to "Extensible Stylesheet Language Transformations"
[4] Page 935
In Figure 12-8, change the rightmost “XML Document” to “Transformed Document (HTML, text, ...)”

 

posted on 2006-09-01 12:39 livahu 阅读(684) 评论(0)  编辑  收藏 所属分类: Java

只有注册用户登录后才能发表评论。


网站导航: