Year equals(Object obj) example
Description
Year equals(Object obj)
checks if this year is equal to another year.
Syntax
equals
has the following syntax.
public boolean equals(Object obj)
Example
The following example shows how to use equals
.
import java.time.Year;
/*w ww .ja va2 s . c o m*/
public class Main {
public static void main(String[] args) {
Year y = Year.of(2014);
System.out.println(y.equals(Year.of(2015)));
}
}
The code above generates the following result.