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 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:
Thanks to Laslo Vukovitch for reporting this.circle.setX(circle.getX() + deltaX); circle.setY(circle.getY() + deltaY);
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:
Thanks to Clare Murnaghan for catching this.if ( (obj1)isLargerThan(obj2) > 0); if ( (obj1)isLargerThan(obj2) < 0); if ( (obj1)isLargerThan(obj2) == 0);
In the Random Numbers section, change the code in line 6 to read int number = (int)(Math.random() * 10); In the same section, line 8, remove the entire sentence that begins "The compiler boxes...."
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!
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
, andnull
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. You cannot use any of the following as identifiers in your programs. The keywordsconst
andgoto
are reserved, even though they are not currently used.true
,false
, andnull
might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs."