Java in a Nutshell, 3rd Edition by David Flanagan The following changes were made in the 6/00 reprint: ** All references to Java 1.3 beta were removed. The Java 1.3 release is now official. (xi) 3rd paragraph "are an server-side" now reads "are a server-side" {20} 3rd paragraph; Unicode character of PI was described: ..., and \u3c00 is the character PI. Now reads: ..., and \u03c0 is the character PI. [25] Under Floating-Point Types; "As shown in table 2-3, float..." Now reads: "As shown in table 2-2, float...". {25} second code block Changed: byte sum = b1 + b2; // Sum wraps to... To: byte sum = (byte)(b1 + b2); // Sum wraps to... {26} block of code in the middle of the page Changed the four lines to read: double inf = 1.0/0.0; // Infinity double neginf = -1.0/0.0; // -Infinity double negzero = -1.0/inf; // Negative zero double NaN = 0.0/0.0; // Not-a-Number Also, in the paragraph above these lines of code, changed "such as 0/0" to "such as 0.0/0.0". Also, in the last paragraph before the "Strings" heading, changed the sentence: 1/0 yields positive infinity, but 1 divided by negative zero yields negative infinity. To: 1.0/0.0 yields positive infinity, but 1.0 divided by negative zero yields negative infinity. {26} 5th paragraph, just above headline "Strings"; Did read: Float.isNan() and Double.isNan() methods. Now reads: Float.isNaN() and Double.isNaN() methods. {26} 2nd paragraph from bottom: "The only way to distinguish negative zero..." Now reads: "One way to distinguish negative zero..." {27} 2nd and 3rd paragraphs of "Type Conversions" Changed the 2nd sentence of the second paragraph to read: A widening conversion occurs when a value of one type is converted to a wider type--one that has a larger range of legal values. Deleted the 3rd sentence of the 2nd paragraph, which began, "A narrowing conversion...fewer bits." And changed the beginning of the 3rd paragraph to read: Narrowing conversions are another matter, however. A narrowing conversion occurs when a value is converted to a type that is not wider than it. Narrowing conversions are not always safe: it is reasonable to convert... Also, changed "$ndash;128" to "-128" {29} Code in middle of page; The following code line: 1.7 // An integer literal Now reads: 1.7 // A floating-point literal {32} 3rd paragraph of "Operand number and type" Changed the last line of this paragraph to read: "...operands must be convertible to the same type." {39} Code under the Bitwise Complement (~) Did read: byte b = ~12 //~00000110 ==> 11111001 or -13 decimal Now reads: byte b = ~12 //~00001100 ==> 11110011 or -13 decimal {39} Code under Bitwise XOR (^) Did read: 10 & 7 Now reads: 10 ^ 7 {41} 1st paragraph of "The Conditional Operator" Changed the last line of this paragraph to read: "...of any type, but they must be convertible to the same type." {43} In the "Object creation (new)" list item Changed first sentence to read "In Java, objects (and arrays) are ..." {44-45} The code blocks that starts at the bottom of 44 and finishes on 45: The code now reads: for(int i= 0; i < 10; i++) { a[i]++; // Body of this loop is a compound statement. b[i]--; // It consists of two expression statements } // within curly braces. Note "statement" previously in Line 3 should be the end of Line 2. (45) 2nd par., "a identifier" now reads "an identifier" {45} 2nd paragraph from bottom: First sentence did read: "does not allow you to use a variable" Now reads: "does not allow you to use a local variable" {46} 3rd code block: The line did read: int j = 0; // Declare j; i and j are in scope here Now reads: int j = 0; // Declare j; the scope of j begins here i++; // i is in scope here; increment it (46, 47, 48) All long equals signs are now separated by a thinspace, making 2 short equals signs (==). (51) footnote Second sentence of this footnote has been removed. {55} paragraph after "Exception types" heading Changed "java.langThrowable" to "java.lang.Throwable". {59} last few paragraphs before "Methods" In the paragraph that starts "In previous discussions...", changed the second to last sentence to read: The finally clause gives us a way to write a while loop that handles the continue statement in the same way that a for loop does. After the second code block, added this new sentence: Note, however, that placing the increment statement within a finally block causes this while loop to respond to break statements differently than the for loop does. {59} first paragraph after "Methods" Changed "A method is a named collection of Java..." to "A method is a named sequence of Java..." {60} bulleted list Changed the fourth bullet item to read: The checked exceptions that the method can throw (the signature may also list unchecked exceptions, but these are not required) {63} 2nd paragraph, 4th line up from bottom: java.lang.Constructor Now reads: java.lang.reflect.Constructor {64} 2nd block of code Changed the following lines: Class typeInt = int.type; Class typeIntArray = int[].type; To: Class typeInt = int.class; Class typeIntArray = int[].class; {66} 4th text paragraph Deleted this paragraph and replaced it with: Every array has a length field that specifies the number of elements it contains. Note that this field is read-only: you can use it to read the length of the array, but you cannot assign any value to it or use it to set or change the length of an array. {66} last code block Changed the following two lines: int[] values; // Array elements initialized elsewhere int total = 0; // Store sum of elements here To read: int[] values; // Assume array is created and initialized elsewhere int total = 0; // Store sum of elements here (73) Last paragraph; Added closing paren after Object, to read "(from Object)," {79} first code block Changed from: public static void main(String args[]) To: public static void main(String[] args) {79} second code block Changed "C:\>" to "%" at the beginning of the code line. {80} code blocks at top of page Changed "C:\>" to "%" at the beginning of each code line. {81} Bottom of the page, "No variable-length argument lists" list item Changed second sentence to read: ...simulate C varargs functions for simple cases, and arguments can also be passed as an Object[],... {91} Code at bottom; The line: private static final NUMPTS = 500; Now reads: private static final int NUMPTS = 500; And the last lines: double x = 0.0, delta_x; delta_x = (Circle.PI/2)/(NUMPTS-1); Now read: double x = 0.0; double delta_x = (Circle.PI/2)/(NUMPTS-1); {99} bottom: This code example is now on two lines, reading: // Invoke the finalizer of our superclass. super.finalize(); {104} 3rd paragraph from bottom: 1st sentence: "...from within the method that overrides it." Now reads: "...from within the class that overrides it." {109} Example 3-4 The line: protected checkRadius(double radius) { Now reads: protected void checkRadius(double radius) { {116} top "upper-left" now reads "upper-right" to correspond with the example {116} middle The line: public setUpperRightCorner(double x, double y); Now reads: public void setUpperRightCorner(double x, double y); {120} Example 3-9: In the following lines: // This method returns an Enumeration... public java.util.Enumeration enumerate() ... Moved the second line right two spaces so it lines up under "//". And in these lines: // The constructor uses the private head field... public Enumerator() ( current ... Moved the second line right four spaces so it lines up under "//". {120} Last sentence: "...code using the LinkedStack class..." Now reads: "...code (in a different package) using the LinkedStack class..." {128} Example 3-11: The 4th line: Linkable current; = head; Now reads: Linkable currrent; (138) 2nd paragraph: The 4th line: "String are immutable" Now reads: "String objects are immutable" {138} Code, near middle: The line: t.getChars(0, 3, ca, 1); // Put 1st 4 chars of s into ca at position 2 Now reads: t.getChars(0, 3, ca, 1); // Put 1st 3 chars of s into ca[1]-ca[3] {141} 2nd code example, The 3rd line: short sh = Short.parseShort(sh); Now reads: short sh = Short.parseShort(s); (209) 2nd para; Changed "Hotspot" to "HotSpot" {209} Code in middle: Did read: % setenv JAVA_COMPILER NONE // Unix syntax Now reads: % setenv JAVA_COMPILER NONE // Unix csh syntax {343} constants of class Double; Did read: public static final double MIN_VALUE; Now reads: public static final double MIN_VALUE; =4.9E-324 (added the value) {356} 1st paragraph under "Object" Deleted the sentence that began "equals() tests whether" and ended "byte-for-byte equivalence)." 3rd paragraph: Deleted the first sentence and replaced it with: The default implementation of the equals() method simply uses the == operator to test whether this object reference and the specified object reference refer to the same object. Many subclasses override this method to compare the individual fields of two distinct objects (i.e., they override the method to test for the equivalence of distinct objects rather than equality of object references). INDEX: * BufferedReader entry now refers to pages 283-284. * Added a new entry for "Resources for further information" under "ResourceBundle class."