ZoneOffset compareTo(ZoneOffset other) example
Description
ZoneOffset compareTo(ZoneOffset other)
compares this offset to another offset in descending order.
Syntax
compareTo
has the following syntax.
public int compareTo(ZoneOffset other)
Example
The following example shows how to use compareTo
.
import java.time.ZoneOffset;
/*from w ww. j a v a 2s . co m*/
public class Main {
public static void main(String[] args) {
ZoneOffset z = ZoneOffset.UTC;
System.out.println(z.compareTo(ZoneOffset.UTC));
}
}
The code above generates the following result.