Owl Sams Teach Yourself Java 1.1 Programming in 24 Hours
Pages with corrections: 85 | 97 | 99 | 105 | 106 | 121 | 123.
Pages with clarifications:
13 | 97 | 157 | 209 | 220 | 234-235 | 264-267 | 304-305.

Errata

The following errors have been found in the first printing of the book (most were corrected for subsequent printings):

Hour 6

  • Page 85: The output of the Credits program in Listing 6.2 is not correct. Here's what the output should be:
    • The Piano (1993)
    • A Jane Campion film.
    •  
    • Ada     Holly Hunter
    • Baines  Harvey Keitel
    • Ada     Holly Hunter
    • Stewart Sam Neill
    • Flora   Anna Paquin

Hour 7

  • Page 97: To make the ClockTalk.java program compatible with the final version of Java Developer's Kit 1.1, the name of two class variables must be changed. In line 7, Calendar.HOUROFDAY should be changed to Calendar.HOUR_OF_DAY. In line 10, Calendar.DAYOFMONTH should be Calendar.DAY_OF_MONTH. With the corrections highlighted in red, lines 7 through 10 should be the following:
    • int hour = now.get(Calendar.HOUR_OF_DAY);
    • int minute = now.get(Calendar.MINUTE);
    • int month = now.get(Calendar.MONTH) + 1;
    • int day = now.get(Calendar.DAY_OF_MONTH);

    For more information, see the corrected source code of ClockTalk.java or download ClockTalk.class.

    There also is a clarification regarding this program.

  • Page 99: In the sample program output immediately above the Coffee Break, a blank line is missing from the output after the line that reads Good morning. Here's what the output should be:
    • Good morning.
    •  
    • It's 30 minutes past 8 o'clock on April 13, 1997.

Hour 8

  • Page 105: The second sentence on the page contains a typo. With the correction highlighted in red, here's what the sentence should be:
    • The test is number < 1000.
  • Page 106: The first code example on the page contains an error in the System.out.println() method. With the correction highlighted in red, here's what the corrected line should be:
    • System.out.println(i + " * " + j + " = " + (i * j));

 Hour 9

  • Page 121: The code example after the second paragraph has an error in the first line. It should be the following, with the correction highlighted in red:
    • boolean[][] selectedPoint = new boolean[50][50];

 

  • Page 123: As it is written, the Wheel program works, but it won't tally up occurrences of the letter Z. To make it possible for this program to catch some Z's, change line 26 on page 123 to the following (the changed text is highlighted in red):
    • if ( (lett >= 'A') & (lett <= 'Z') ) {

    For more information, see the corrected source code of Wheel.java or download Wheel.class.

Clarifications

The following clarifications might help if you're confused about something from the first printing of the book:

Hour 1

  • Page 13: For more help setting up the Java Developer's Kit to work with Windows 95 and Windows 3.1 systems, read the Using the Java Development Kit tutorial.

Hour 7

  • Page 97: Some readers have reported problems getting the correct time to be displayed on their systems. This is happening because the Java intrerpreter could not determine what time zone to use due to a bug in Java 1.1. To fix this, you can explicitly set the time zone to use with statements such as the following:
    • TimeZone tz = TimeZone.getTimeZone("EST");
    • TimeZone.setDefault(tz);

    TimeZone is part of the java.util package. The argument to the getTimeZone() method is the ID of the time zone, which can be any of the following: GMT, UTC, ECT, EET, ART, EAT, MET, NET, PLT, IST, BST, VST, CTT, JST, ACT, AET, SST, NST, MIT, HST, AST, PST, PNT, MST, CST, EST, IET, PRT, CNT, AGT, BET, or CAT.

    There also is a correction for the ClockTalk.java program listed earlier on this page.

Hour 12

Hour 16

  • Page 209: The Danger applet listed in full on page 209 will run successfully on a Web page, but you will get an odd message when you compile it: a "deprecation" warning. This message means that you're using a programming technique from Java 1.0.2 that has been replaced with a better technique in Java 1.1. In this case, the deprecation warning occurs because the size() method has been replaced with the getSize() method. Both methods do the same thing, but Java's developers renamed it to be consistent with other parts of the language. To remove the deprecation warning from the Danger applet, you can make a change to the listing on page 209. With the change highlighted in red, Line 17 should be the following:
    • textX = getSize().width / 2 - fm.stringWidth(text) / 2;

    For more information, see the revised source code of Danger.java or download Danger.class.

Hour 17

  • Page 220: For the same reason as the clarification to Page 209, the JavaMan applet runs successfully but causes a deprecation warning when compiled. To remove the warning, replace all references to size() with references to getSize(). They occur on Lines 12-13 of the listing on page 220. For more information, see the revised source code of JavaMan.java or download JavaMan.class.

Hour 18

  • Page 234-235: For the same reason as the clarification to Page 209, the Bounce applet runs successfully but causes a deprecation warning when compiled. To remove the warning, replace all references to size() with references to getSize(). They occur on Lines 18, 25, 29, and 51. For more information, see the revised source code of Bounce.java or download Bounce.class.

Hour 18

  • Page 234-235: For the same reason as the clarification to Page 209, the Bounce applet runs successfully but causes a deprecation warning when compiled. To remove the warning, replace all references to size() with references to getSize(). They occur on Lines 18, 25, 29, and 51. For more information, see the revised source code of Bounce.java or download Bounce.class.

Hour 20

  • Pages 264-267: The LottoMadness applet will run successfully as it is listed, but there's an easy error to make when you're typing it in. On Lines 138, 162, 186, and 194, two double quotation marks appear side-by-side. Here's how they appear on Line 138, with the quote marks highlighted in red:
    • numbers[i].setText("" + pick);

    Because of the way the listing appears in the book, some readers are typing in the quote marks with a space between them, as in the following incorrect version of Line 138:

    • numbers[i].setText(" " + pick);

    The LottoMadness program won't work correctly unless the quotation marks appear side-by-side without a space between them. The purpose of using the "" along with a variable, as in "" + pick, is to turn the argument of the setText method into a String.

Hour 23

  • Pages 304-305: For the same reason as the clarification to Page 209, the Pan applet runs successfully but causes a deprecation warning when compiled. To remove the warning, replace all references to size() with references to getSize(). They occur on Lines 14, 23, 54-57, and 71-72. For more information, see the revised source code of Pan.java or download Pan.class.