Current location - Training Enrollment Network - Books and materials - Establish a library with Java(Bluej), and LinkedList in books, lending classes, TreeSet libraries and lending books.
Establish a library with Java(Bluej), and LinkedList in books, lending classes, TreeSet libraries and lending books.
Comparable is the top interface of set array sorter in java, and its compareTo method is implemented.

Of course, your method is public, so it doesn't matter where it is. It is better to design it in a book to facilitate the custom comparison of member variables, because the collection is in the library, and it will automatically help you sort when you construct the collection, which is new.