Java Instant compareTo() methodThe compareTo() method of Java Instant class is used to compare this instant to the specified instant. SyntaxParametersotherInstant - The other instant to compare to, not null. ReturnsThe comparator value, negative if less, positive if greater. ExceptionsNullPointerException - if otherInstant is null. Example 1Output: The output will be like this. Instant 1: 2018-07-17T10:37:30Z Instant 2: 2018-07-17T10:37:30Z Instant 2 is greater than Instant 1. Example 2Output: 1 Next TopicJava-instant-plusseconds-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India