These errors are corrected in the 4th printing.
Some Linux systems automount the CD with a filesystem that forces all file names to lower case. This will break browser links to HTML files with mixed-case names, and also prevent the examples from compiling.
If you have this problem, try manually mounting the CD with the UDF filesystem. To do this:
umount cd_device_path
mount -t udf cd_device_path cd_mount_point
The source code inside figure 1.2 is missing a closing bracket to end the class definition.
The missing bracket appears in bold below:
class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } }
Thanks to the anonymous reader who reported this!
Typo fix: In the following sentence, the word "operand" (shown in bold) was mistakenly printed as "operator":
"The equality and relational operators determine if one operand is greater than, less than, equal to, or not equal to another operand."
Thanks to Dirk Henrici for reporting this!
In the Bicycle
class, the getspeed()
method should be called getSpeed()
.
In the example in the second paragraph, getX and getY should be changed to getX() and getY() so that the 3rdand 4th lines in the example read:
circle.setX(circle.getX() + deltaX); circle.setY(circle.getY() + deltaY);
In the SeeWhosFastest()
method, the method should be called seeWhosFastest()
.
The last word in the Note should be changed from "variables" to "methods" so that the sentence reads: "You can also refer to static methods with an object reference like instanceName.methodName(args) but this is discouraged because it does not make it clear that they are class methods."
The code "if ( (obj1)isLargerThan(obj2)) ..." should be changed to "if ( (obj1)isLargerThan(obj2) ..." in three places by removing the extra parenthesis, ). The three lines should read:
if ( (obj1)isLargerThan(obj2) > 0); if ( (obj1)isLargerThan(obj2) < 0); if ( (obj1)isLargerThan(obj2) == 0);
In the title for Table 8.3, the file name should be TestFormat.java
.
In the Random Numbers section:
int number = (int)(Math.random() * 10);
Thanks to Serge Abrashevich for pointing this out.
In the picture, change substring(sep, dot) to substring(sep + 1, dot)
Thanks to Tomec Czechowski for pointing this out.
The second paragraph from the bottom reads: To see this effect more clearly, try removing the continue
statement and recompiling. When you run the program again, the count will be wrong, saying that it found 44 p's instead of 9. In fact, when you run the program again, the count is 35.
Thanks to Cesar Siqueira for being the first to report this error!
The footnote takes you to the wrong URL. The correct URL is:
docs/books/tutorialJWS/deployment/webstart/examples/Notepad.jnlp
There is a clarification to the descriptive text above the keyword list.
Previous text: "Here's a list of keywords in the Java language. These words are reserved — you cannot use any of these words as names in your programs. true
, false
, and null
are not keywords but they are reserved words, so you cannot use them as names in your programs either."
Clarified text: "Here's a list of keywords in the Java programming language. 你不能在程序中使用以下任何一个作为标识符。关键字 const
和 goto
是保留的,即使它们当前未被使用。true
, false
, and null
might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs."