public class Book {
    String title;
    int    isbn;

    Book(String title, int isbn) {
        this.title = title;
        this.isbn  = isbn;
    }

    public String toString() {
        return title + " " + isbn;
    }

    public boolean equals(Object object) {
        if (object == null) {
            return false;
        }
        if (object == this) {
            return true;
        }
        if (object.getClass() == this.getClass()) {
            Book other = (Book) object;
            return this.title.equals(other.title) 
               && (this.isbn == other.isbn);
        }

        return false;
    }

    public int compareTo(Object object) {
        if (object == null) {
            return -1;
        }
        Book other = (Book) object;
        if (this.title.equals(other.title)) {
            return this.isbn - other.isbn;
        }
        return this.title.compareTo(other.title);
    }
}

