Second Edition – Updates and Revisions
No work is without error and this tome is no exception. This page presents those substantive errors that we have found or have been informed of by others. We have chosen not to present trivial errors (of punctuation or spelling) here. We are, however, very pleased to hear from people about all errors, small and large (though we hope there are actually none of the latter) so that we can improve the book for the next revision and/or edition.
The clone methods in a number of the classes are not as good as they could be. It is important for classes that are not final that clone methods are equally appropriate for class and subclasses subclasses. Some of the clone method implementations in some of the classes presented in the book are appropriate for final classes but the classes are not final so there is a problem. So, for example, on page 375 in the Array class the clone method is written:
public final Object clone() {
Array a = new Array (theSize < initialSize ? initialSize : theSize, incrementSize ) ;
a.theSize = theSize ;
for (int i = 0 ; i < theSize ; ++i) {
a.datum[i] = datum[i] ;
}
return a ;
}
but this is not an appropriate implementation because the Array class is not final. Instead the procedure should read:
public final Object clone() {
Array a = (Array)super.clone() ;
a.datum = (Object[])datum.clone() ;
return a ;
}