Instant equals(Object otherInstant) example
Description
Instant equals(Object otherInstant)
checks if
this instant is equal to the specified instant.
The comparison is based on the time-line position of the instants.
Syntax
equals
has the following syntax.
public boolean equals(Object otherInstant)
Example
The following example shows how to use equals
.
import java.time.Instant;
// www. j a v a 2 s . com
public class Main {
public static void main(String[] args) {
Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
System.out.println(instant.equals(Instant.now()));
}
}
The code above generates the following result.