Java Date Time Java Java API
java.time.Year
public boolean isBefore(Year other)
Checks if this year is before the specified year.
package com.logicbig.example.year;import java.time.Year;public class IsBeforeExample { public static void main(String... args) { Year y = Year.of(2011); System.out.println(y); Year y2 = Year.now(); System.out.println(y2); boolean b = y2.isBefore(y); System.out.println(b); boolean b2 = y.isBefore(y2); System.out.println(b2); }}
20112017falsetrue