code in the book -- thinking in java