# Errata for The Java Tutorial, 4th Edition

### First Printing

- CD problems on Linux:

  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:

  - Become superuser.
  - Unmount the cd:

        umount cd_device_path

  - Remount the the cd using the UDF filesystem:

        mount -t udf cd_device_path cd_mount_point

- Chapter 1: Getting Started, page 3:

  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!

- Chapter 3: Language Basics, page 59:

  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!

- Chapter 4: Classes and Objects, page 97:

  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);

  Thanks to Laslo Vukovitch for reporting this.

- Chapter 4: Classes and Objects, page 114:

  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."

- Chapter 5: Interfaces and Inheritance, page 145:

  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);

  Thanks to Clare Murnaghan for catching this.

- Chapter 8: Numbers and Strings, page 208:

  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.

- Chapter 8: Numbers and Strings, page 223:

  In the picture, change substring(sep, dot) to substring(sep + 1, dot)

  Thanks to Tomec Czechowski for pointing this out.

- Chapter 13: Regular Expressions, page 80:

  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!

- Appendix A

  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. You cannot use any of the following as identifiers in your programs. The keywords `const` and `goto` are reserved, even though they are not currently used. `true`, `false`, and `null` might seem like keywords, but they are actually literals; you cannot use them as identifiers in your programs."