OffsetTime compareTo(OffsetTime other) example
Description
OffsetTime compareTo(OffsetTime other)
compares this OffsetTime to another time.
Syntax
compareTo
has the following syntax.
public int compareTo(OffsetTime other)
Example
The following example shows how to use compareTo
.
import java.time.OffsetTime;
//from w w w. j a va 2s . c o m
public class Main {
public static void main(String[] args) {
OffsetTime m = OffsetTime.now();
System.out.println(m.compareTo(OffsetTime.now()));
}
}
The code above generates the following result.