Dear Kevin Lee,
I dont know the way you want your Book class to work....
but i am telling the way how to use the compareTo()
& your error is simple , all our friends already explained.
you need here two things
1) how to use equals()
2) intention of compareTo()
for equals() go through Thinking in
Java ed.4...
now for the CompareTo() the implementation must be as follows.
let b1 & b2 are your book instances
1) if b1.equals(b2) is true then b1.compareTo(b2)==0 must be true...
2) if b1.equals(b2) is false then b1.compareTo(b2) must return a non-zero...
3) any_book_obj.compareTo(null) must throw NullPointerException.
4) for incompatiable class it must throw ClassCastException.
Click Here for More
your modified program is