Introduction to Programming Using Java, Eighth Edition
News and Errata
News for the Eighth Edition of This Book
- March 14, 2022 — A preliminary release of Version 9.0 of this textbook is now available at https://math.hws.edu/javanotes9. The official release will be in the middle of May. Version 9 comes in two editions, one one using JavaFX for GUI programming and on using Swing. The preliminary release of the Swing edition is at https://math.hws.edu/javanotes9-swing.
- March 9, 2022 — Lab assignments for my Fall 2021 Introductory Programming class are available on the course web page at https://math.hws.edu/eck/cs124. The course covered Chapters 1 through 7 in Version 8.1.3 of this textbook. That page also has links to solutions for most of the labs.
- September 24, 2021 — OpenJDK 17 is now available and can be downloaded from https://adoptium.net. This textbook has recommended getting OpenJDK from adoptopenjdk.net, but AdoptOpenJDK has transitioned to Adoptium, and you should look for new downloads at adoptium.net.
- August 1, 2021 — Version 8.1.3 is released, with updates to information about Java versions and about Eclipse in Section 2.6. There are some other small changes, including a few error corrections.
- May 7, 2021 — The lab assignments from my Spring 2021 Introductory Programming course, using Chapters 1 through 7 of this book, can be found at http://math.hws.edu/eck/cs124/index_s21.html.
- December 29, 2020 — Version 8.1.2 is released. This small update fixes a few errors, adds very short introductions to two new Java features (text blocks and records), and updates the information about programming environments in Section 2.6.
- May 19, 2020 — Version 8.1.1 is released. This is a really tiny update, released for the web and PDF versions of the book only. The main motivation was a change in the links to the print versions at lulu.com. I also updated Section 2.6 to reflect the fact that the current version of Java is Java 14, and Subsection 3.6.5 to say that the new switch statement syntax is now an official part of the language.
- July 2, 2019 — Version 8.1 is released. This is a minor update whose main purpose is to make it clearer how to use the book with Java 11 and JavaFX. The major changes are in Section 2.6. A few short topics from Java 11 and Java 12 have also been added. The main web address for the book, http://math.hws.edu/javanotes, now points to the eighth edition.
- May 15, 2019 — The lab assignments from my Spring 2019 Intermediate Programming course, using Chapters 8 through 13 of the eighth edition, can be found at http://math.hws.edu/eck/cs225/.
- December 5, 2018 — The official release of the Eighth Edition. Once again, I am indebted to John Ganci, who contributed many corrections to the "beta" version of this edition.
- August 19, 2018 — A "final beta" version of the Eighth Edition is available for browsing on the web and for download. The official release of the Eighth Edition will take place some time after Java 11 is released.
Errata for Version 8.1
This is a list of substantive errors that have been found in Version 8.1.
- Section 2.5: A reader wrote to point out some errors in the description of Java
expressions in Section 2.5. The statement in Subsection 2.5.3 that said
x == Double.NaN
andx != Double.NaN
are bothfalse
in all cases is not correct. In fact,x == Double.NaN
is defined to be false in all cases, andx != Double.NaN
is defined to betrue
in all cases. Also, Subsection 2.5.6 incorrectly said that there is an assignment operator&&=
. There is no such operator. [Fixed in version 8.1.2.] - Section 2.6: Near the end of Subsection 2.6.3, a .bat file for compiling JavaFX programs on the command line in windows is given as javac -p C:\Users\eck\openjfx-sdk-11\lib --add-modules=ALL-MODULES-PATH $*. It should be javac -p C:\Users\eck\openjfx-sdk-11\lib --add-modules=ALL-MODULE-PATH %*. Note the use of % at the end instead of $, and the extra "S" that was added to ALL-MODULE-PATH in the incorrect version. [Fixed in version 8.1.3.]
- Section 2.6: In the last paragraph of Subsection 2.6.7,
"For example, if a program is in a package named
text.pkg
" should be "For example, if a program is in a package namedtest.pkg
". [Fixed in version 8.1.2.] - Source file RandomCircles.java for Chapter 3: The comments on this file were not updated from an earlier version and did not correctly describe the program. [Comments are corrected in version 8.1.2.]
- Section 4.4: At the start of the sample program ThreeN2 in Subsection 4.4.3,
input textio.TextIO
should beimport textio.TextIO
. [Fixed in version 8.1.2.] - Section 6.4: The method control.setToolTipText(text) for setting the tool tip for a control is incorrect. This is left over from the Swing GUI. In JavaFX, a tool tip can be set using control.setTooltip(new Tooltip(string)). [Fixed in version 8.1.3.]
- Section 7.5: In the illustration of a symmetric matrix in Subsection 7.5.1, two of the
entries are not symmetric.
M[0][3]
should be 6, not 13, andM[3][6]
should be -4, not 4. [Fixed in version 8.1.2.] - Section 7.2: In the next-to-last code segment in Subsection 7.2.1,
double B
should bedouble[] B
. [Corrected in Version 8.1.1.] - Section 10.1: In several places, JFC is used as the abbreviation for the Java Collection Framework. It should be JCF. [Fixed in version 8.1.3.]
- Excercise 10.5: This exercise defines a class named
ScoreInfo
, but the constructor in the class is namedScore
. The constructor should have the same name as the class, so all occurrences of Score should be replaced by ScoreInfo. [Fixed in the online textbook but not in Version 8.1.3 downloads.]
Errata for Version 8.0
This is a list of substantive errors that were found in the original Version 8.0 from December 2018. These errors have been corrected in Version 8.1.
- Section 3.9, Section 1: Three occurrences of g.drawLine should be g.strokeLine
- Chapter 6 Quiz Answers, in the answer to Question 5, "The drawLine command" should be "The strokeLine command".
- Section 10.6, next-to-last paragraph of the introductory material: "The net result is that we've added up the lengths of all the streams in the list" should be "The net result is that we've added up the lengths of all the strings in the list.
Some Old News
- November 25, 2017 -- My CPSC 124 web site includes programming assignments as well as tests and quizzes from the Fall 2017 of my Introductory Programming course [using the seventh edition of this textbook].
- March 19, 2016 -- I have added eBook versions of this textbook to the web site, in "epub" format and in "mobi" format for Kindle. They can be downloaded using links at the bottom of the front page. Note that there can be problems with the rendering of long lines in code samples, and that the problems will be worse on some devices. The eBook versions should be considered somewhat experimental. In addition to adding the eBooks, a very small number of errors (about a half dozen) have been fixed in the on-line and PDF versions, without changing the version number.
- August 1, 2014 -- Version 7 is released. Version 7 requires Java 7 or later. Note that with this version, the book no longer cover applets, and there are no applets in the on-line version. Readers are encouraged to download, compile, and run the examples. Links for downloading are available on the front page.
- May 17, 2013 -- Version 6.0.2 is released, with fixes for many small, mostly typographical errors. Again, thanks to readers who sent in error reports, especially Mark Christy and John Ganci, who found many errors.
- June 1, 2011 -- Version 6.0 is released. The sixth edition adds a new chapter on threads and multiprocessing and some coverage of new features of Java 6 and Java 7. Thanks to many readers who wrote with suggestions and error reports, especially to Jeff Wexler who sent a large numbers of corrections.