Java Date Time - Year isAfter(Year other) example








Year isAfter(Year other) checks if this year is after the specified year.

Syntax

isAfter has the following syntax.

public boolean isAfter(Year other)

Example

The following example shows how to use isAfter.

import java.time.Year;
/*w ww  . ja  v a  2s.  co m*/
public class Main {
  public static void main(String[] args) {
    
    Year y = Year.of(2014);

    System.out.println(y.isAfter(Year.of(2015)));

  }
}

The code above generates the following result.