ZoneOffset compareTo(ZoneOffset) method in Java with Examples

The compareTo(ZoneOffset) method of ZoneOffset Class in java.time package is used to compare another instance of ZoneOffset passed as the parameter to this ZoneOffset instance. This method returns an integer value which is the comparator value.


public int compareTo(ZoneOffset anotherZoneOffset)

Parameters: This method accepts accepts a parameter anotherZoneOffset which is to be compared to this ZoneOffset instance.

Return Value: This method returns an integer value as follows: