LocalTime compareTo(LocalTime other)
compares this LocalTime to
another time.
compareTo
has the following syntax.
public int compareTo(LocalTime other)
The following example shows how to use compareTo
.
import java.time.LocalTime; public class Main { public static void main(String[] args) { LocalTime l = LocalTime.now(); System.out.println(l.compareTo(LocalTime.NOON)); } }
The code above generates the following result.