Java in a Nutshell, 4th edition by David Flanagan The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification This page was updated June 28, 2006. UNCONFIRMED errors and comments from readers: [18] Third line from the bottom of the page; One of our reader suggests that nul = ' ' is not conform to the latest specification of the language. char a = '\u0000'; /* ok */ but char a = ''; /* compile error! */ {20} First paragraph of "The Unicode Character Set"; The second to last sentence says: "The format is designed so that plain ASCII and Latin-1 text are valid UTF-8 byte streams". Plain ASCII is valid UTF-8 but Latin-1 is not. The top half of Latin-1 uses the high order bit of each byte in a manner quite contrary to UTF-8. Latin-1 is the same as the first 256 positions in Unicode but when Unicode text is represented as UTF-8 the encoding of characters which are valid Latin-1 but beyond the basic ASCII set will be different from pure Latin-1. In fact, the extra Latin-1 characters will be encoded as two bytes each in UTF-8. An example from The Unicode Standard, Version 3.0, page 19: The character LATIN CAPITAL LETTER A WITH RING ABOVE is represented in the ISO-8859-1 (Latin-1) character set as 0xC5 and in Unicode as U+00C5 (i.e., the same numerical value) but when this is encoded as UTF-8 it is represented by the two byte sequence 0xC3 0x85. Conversely, if a Latin-1 A ring character (i.e., a 0xC5 byte) was encountered in a file being read as UTF-8 it would be misinterpretted as the first byte of a two or more byte UTF-8 sequence. (21) 15th row from the bottom; The book reads "An identifier must begin with [...] or a Unicode currency symbol[...]". If that is so, then the example of a legal identifier on row 6 from the bottom is wrong. Because the character theta is not a currency symbol, or a letter, or an underscore. {40} paragraph 4; It reads 'If the left operand is a long, the right operand should be between 0 and 63. Otherwise the left operand is taken to be an int, and the right operand should be between 0 and 31.' This is wrong! The modulo 64 or modulo 32 value of the right operand is used. So if an int is <<'d by 34, it really is <>> 2 // 0xFFFFFFCE >>> 2 = 0x3FFFFF33 = 107371811" is wrong, it should be, "-50 >>> 2 // 0xFFFFFFCE >>> 2 = 0x3FFFFFF3 = 1073741811" (43) First sentence in "Statements" section; "A statement is a single command executed b the Java interpreter" {67 and 91}: // Create a Point object representing (2, 3.5) and store it in variable p Point p = new Point(2.0, 3.5); And on page 91: Circle c = new Circle(); // Create a new Circle object; store it in variable c This is inaccurate. References to the objects are actually being stored, not the objects themselves. Perhaps this is an actual bug, or maybe this was written intentionally to simplify things, but in either case IMHO it should be corrected, as it can confuse the reader ^^ (91) 4th paragraph; Beginning of 4th paragraph starts like this. To use an instance method from outside the class in which it is defined, we must prepend a reference...blah, blah, blah what is the meaning of the word prepend? English is not my mother tongue and prepend is not in my English dictionary. (93) 2nd complete paragraph; The 3rd sentence "There are many cases in which is is..." should read "There are many cases in which it is...". (97) 3rd paragraph - - I do not have the book with me and am not certain if this is the actual paragraph; The following sentence contains the error: "If you disassemble the byte codes in a Java class file, you'll see the class initialization code in a method named ." "static" is the name of the method that contains the class initialization code. This method is not called as described on Page 97. (101) last sentence on page; There is a stray "it". The last sentence "The ability...by subclassing, or extending, it is central..." should read "The ability...by subclassing, or extending, is central...". [110] 5th complete paragraph (just above Data Hiding and Encapsulation), last sentence; The sentence states that the super syntax may be used to invoke a shadowed class method. It should be clarified that this syntax only valid in instance methods. The only syntax available within static methods is using the parent class name. (121) 2nd paragraph; On the fourth line of paragraph two is a sentence beginning "If you use an abstract clas..." An 's' was left out of the word "class". {162} 4th line; A Timer object named "timer" is instantiated on line 2. Two lines later, the schedule method is called, except you've printed "Timer.schedule(...)" (which mistakenly attempts to invoke an instance method on a class) instead of the correct "timer.schedule(...)". [163] Sample code for Deadlock; The sample code states t2.start(); // Locks resource2 and now neither thread can progress! This is entirely dependent on the scheduling of threads. This sample code can complete successfully (and probably will on a lot of systems if this this the only code executed). A note clarifying this would be helpful as a reader may enter the code and be confused when a deadlock does not occur {163} First paragraph under "Coordinating Threads with wait() and notify()" heading; The fifth sentence here states "When a thread calls the wait() method of an object any locks the thread holds are temporarily released ...". This isn't correct (or at least the use of "any locks" is misleading) - the thread ONLY releases the lock for the object whose wait() method was invoked; any other objects' monitors held by that thread will not be released. This is confirmed by the following link to the online API documentation: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#wait(long) (177) TextEditor example; Missing comma in code example: dictionary = userprefs.get("dictionary" ^ {183} Near the top of the page; "The preceeding code relies on the fact that ISO-8895-1 is an 8-bit encoding..." Should say "ISO-8859-1", not "ISO-8895-1". , (186) unconnected socket example; s.setSOTimeout ^ wrong case, should be: s.setSoTimeout (198) first code chunk; The code used to describe how to apply a digital signature to a byte[] array uses a String variable named "signer" to hold the name of the key's alias. This is confusing, because when you use keytool to generate a key, you can specify the alias (a unique name within that keyfile), as well as the name of the signer. In the example code, signer contains a value of "david" and is passed to keystore.getKey(...). This makes is seem to the reader that the first value passed to getKey is the name of the person who signed the private key, rather than the alias of that private key. (It took me a while to figure this out). I think this could be easily clarified by naming the variable "alias" instead of "signer". {247} 3rd and 4th paragraph; In the VM options, the book says the default for -Xms is 1MB and for -Xmx is 16Mb. According to the JDK docs (for both JDK 1.3.x and 1.4.x), these defaults are 2Mb and 64 Mb respectively. {379} First paragraph, first sentence of Byte description; For consistency with the other primitive wrapper classes, the word 'immutable' should be inserted as follows: 397 currently eads, "This class provides an object wrapper..." but should read, "This class provides an immutable object wrapper...". If the class is mutable, explain why it differs from the other 7 primitive wrappers. Currently it is misleading and can seem slightly reliable since this is the most fundamental data type to a computer (through some ill-conceived discontinuous matter of rational). {413} First paragraph, first sentence of Short description; For consistency with the other primitive wrapper classes, the word 'immutable' should be inserted as follows: 413 currently eads, "This class provides an object wrapper..." but should read, "This class provides an immutable object wrapper...". If the class is mutable, explain why it differs from the other 7 primitive wrappers. {648} 5th line - setTimeInMillis(long millis); "public void setTimeInMillis (long millis)" should be "protected" sted "public". {855} 3rd paragraph; "If that method [getCharacterStream] returns false..." can't be right. getCharacterStream returns a pointer. According to the SAX documentation null is used to indicate that there isn't a character stream available.