To sort such a list using the List.sort method, your Apex classes must implement the Comparable interface.
The sort criteria and sort order depends on the implementation that you provide for the compareTo method of the Comparable interface. For more information on implementing the Comparable interface for your own classes, see the Comparable Interface.