Java: First Contact

Roger Garside and John Mariani, Computing Department, Lancaster University

Course Technology / September 1997 / ISBN 1-85032-316-X
46.65 US dollars / 21.95 pounds sterling

Errata List (Last Updated 6/October/97)

Chapter 1

p27: exercise 2 is really the 2nd paragraph of exercise 1

Chapter 4

p97: in the last paragraph "shown in rows four and five" should be "shown in rows three and four"

p103: 2nd line from bottom should start "char operator = ..."

p107: the bracketing is wrong in the code at the bottom - it should be:

if ((response.equals("male")) ||
    (response.equals("Male")) ||
    (response.equals("MALE")))
        myPerson.setGender(Person.MALE) ;
...

Chapter 5

p123: code at the bottom should start "for (int i = 0 ..."

Chapter 6

p142: in the middle line of the paragraph starting "The symbol * is ..." the symbol "pi" is missing twice - it should read "(where for instance 2 pi r means 2 times pi times r)"

p146: just above the code near the bottom delete "and area"; change the text output by code from "the area of a field ..." to "the perimeter of a field..."

Chapter 9

p233: the code just over half-way down the page should be:

int MAX_NO_OF_PERSONS = 100 ;
Person[] personGroup = new Person[MAX_NO_OF_PERSONS] ;
int noOfPersons = 0 ;

Chapter 10

p258: constructor call should be "new OurDate(1957, 3, 8)"

Chapter 12

p315 the symbol pi has been omitted in exercise 3 - the first two parts should read:

3. a) Write a class, Circle, that has one attribute, radius, and a method,
space, which returns the area of the circle.  The formula for calculating
the area of circle is "pi times r squared", where r is the radius.  Provide
additional methods as required and a driver application.

b) Write a class, Sphere, as a subclass of Circle.  It also has one attribute,
radius, and a method, space, which returns the volume of the sphere.  The
formula for calculating the volume of a sphere is "4/3 pi r cubed", where r
is the radius.  Provide additional methods as required and a driver
application.

Chapter 13

p332: in the code near the bottom "seatType" should be "seatSort"

Chapter 14

p340 Table 14-1: the symbol pi has been omitted four times: the surface area of a cylinder is "2 * ((pi * radius * radius) + (pi * radius * height)), and its volume is "pi * radius * radius * height"; the surface area of a sphere is "4 * pi * radius * radius" and the volume is "4/3 * pi * radius * radius * radius"

p341: in the "volume" method "4/3" should be "4.0/3.0"

p351-2: methods "getX/YLoc" should be "getX/YLocation"

Chapter 16

p404: the ""Quit" button should be set up as follows:

quit = new MenuItem("Quit") ;
menuA.add(quit) ;
quit.addActionListener(this) ;

Chapter 17

p444 figure 17-28: the arc from node 6 to 10 should be labelled "STOP"

Chapter 18

p448: align the mathematical definition of factorial as follows:

factorial(n) = 1                       if n = 0
	       n * factorial(n - 1)    if n > 0

p462: in the code "pointer.elementCount++" should be "pointer.occurrenceCount++"

p464: "count" should be "occurrenceCount" on the 2nd line from the top and the 4th line from the bottom

Chapter 19

p477 figure 19-8: the should be no gap between "... to be" and "that is ..."

Chapter 23

p551: in the note "byteres[]=" should be "byte res[] =", and "byte[]res=" should be "byte[] res = "

Chapter 24

p571: "getNum" should be "getNumber"

Appendix B

p613: title of appendix B should be "Java 1.0.2"


Return to main page

last updated: 29th January 1998