Introduction to Programming Using Java, Version 5.0
News and Errata
- June 30, 2010 -- Version 5.1.2 is released, with just very minor corrections. This is the last release for Version 5 of Introduction to Programming Using Java. Version 6 will be released within the next year.
- June 28, 2010 -- I taught a Programming II class in the Spring semester of 2010, using Chapters 8 through 12 of this book. Materials from that course are available at http://math.hws.edu/eck/cs225/index.html.
- December 19, 2009 -- Version 5.1.1 is released, with minor corrections. Also part of this release is a download of the complete source files for this textbook.
- December 15, 2009 -- I have just finished teaching an introductory programming course based on Chapters 1 through 7 of this book. Materials from the course can be found at http://math.hws.edu/eck/cs124/index.html.
- June 20, 2009 -- Version 5.1 is released, with minor updates and corrections from Version 5.0.
- December 14, 2008 -- A reader (Matias Niklison, from Argentina) has noted a small error in the way that I handle saving of files when a file of the same name already exists. I present a dialog box asking whether the user want's to replace the existing file. I test the user's response with "if (response == JOptionPane.NO_OPTION)". As the reader points out, this test allows the existing file to be replaced when the user closes the dialog box by clicking on its close box (the response in this case is JOptionPane.CANCEL_OPTION rather than JOptionPane.YES_OPTION). I agree that this behaviour is incorrect. Changing the test to "if (response != JOptionPane.YES_OPTION)" fixes the problem. This change should be made in a number of places in the text and in the sample source code. I will make the changes with the next minor version update (which will be coming up soon).
- November, 2007 -- A bug has been discovered in TextIO.java by students of Prof. D. McCarthy of Brock University: When the input source is changed, unread data from the previous source remained in the buffer so that the next "get" operation would take its input from the old source instead of the new source. A related bug was found in TextIOApplet.java by Praveen Pendyala in India that affects some of the TextIO-based applets on web pages in the book: When the user presses the "Run Program" button, there could still be some data in the buffer from the previous run of the program. In addition to these bugs, I have noticed an error in Subsection 12.5.3, in which I said that the locale code for Japan is "jp"; in fact, the code for Japan is "ja". Finally, I thank Beatrice Santorini, who has reported a variety of typographical errors in the book. These bugs and errors are fixed in Version 5.0.2 of the textbook, released in November 2007.
- May 1, 2007 -- Version 5.0.1 has been released. This version is identical to Version 5.0, which was published in December 2006, except for the correction of typographical errors and a very small number of substantive errors, which are listed below. Version 5.0.1 has replaced Version 5.0 on the web site. This news page has been superceded by http://math.hws.edu/eck/cs124/javanotes5/news_5_0_1.html.
- February 5, 2007 -- OOP2_from_Univ_KwaZulu-Natal.pdf. Anban Pillay (School of Computer Science, University of KwaZulu-Natal, Durban, South Africa) has put together a set of notes for a second course in Object Oriented Programming using Java. This is the second version of his notes; it is based on Version 5.0 of my book. The notes use parts of Chapters 4, 5, 6, 8, 9, 10, and 11 together with additional material from other sources. A nice PDF (1.4 MB) of the notes can be downloaded through this link. See the preface of the PDF for more details.
- January 16, 2007 -- I have made a printed version of the full textbook available at lulu.com. See http://www.lulu.com/content/612392. Previously, only the first seven chapters were available in a printed version. The complete version, at 700 pages, is rather thick and a little unwieldy. (Please do not feel any obligation to buy the printed version -- I do not make any money from it.)
- January 16, 2007 -- A new "linked" PDF has been added to the download section of the main page. This PDF contains internal links for navigation and external links to material on the web site that is not included in the PDF. This PDF in more suitable for reading on line, rather than printing.
- December 18, 2006 -- Version 5.0 is released. This version of the book requires Java 5.0 or higher.
This is a list of substantive errors in Version 5.0 that
have been corrected in Version 5.0.1 as of May 1, 2007
- Near the end of Section 5.3.2: Wrapper Classes and Autoboxing, the reference to Double.isNaN() should be Double.isNaN(x).
- In Section 5.4.2: The Card Class, there is a bug in the source code for the Card class. The bug is in the constructor public Card(int theValue, int theSuit), where the line "if (theSuit != JOKER && theValue < 1 || theValue > 13)" requires another set of parentheses: "if (theSuit != JOKER && (theValue < 1 || theValue > 13))". Because of the precedence of the logical "and" and "or" operations, the order of evaluation is incorrect without the extra parentheses.
- In Section 6.6.3: JCheckBox, the typecasts in the lines "boolean newState = ((JCheckBox)cb1).isSelected()" and "boolean newState = ((JCheckBox)cb2).isSelected()" are unnecessay, since cb1 and cb2 are already declared to be of type JCheckBox.
- In Section 7.2.6: Variable Arity Methods, in the definition of the method average(), the line "sum = sum + numbers;" should be "sum = sum + numbers[i];". Also, in the next paragraph, the reference to the method call "numbers(salesData)" should be "average(salesData)".
- In Section 10.1.3: Generic Programming in Java, in the sentence 'Even worse, you can't create an array that has base type ArrayList<String> using the new operator, as in "new ArrayList<String>(N)",' the last thing in the sentence should read "new ArrayList<String>[N]", with square brackets around N instead of parentheses. The new operator is used with square brackets to create an array. With parentheses, it simply creates an object of type ArrayList<String>, which is entirely legal.
- Near the end of Section 10.2.3: TreeSet and HashSet, in the list that shows how to implement mathematical set operations using Java Set operations, the meaning of removeAll and retainAll are reversed. It should read: A.retainAll(B) computes the intersection of A and B, and A.removeAll(B) computes the set difference, A - B.