Close

Java Date Time - Year.isAfter() Examples

Java Date Time Java Java API 


Class:

java.time.Year

java.lang.Objectjava.lang.Objectjava.time.Yearjava.time.Yearjava.time.temporal.TemporalTemporaljava.time.temporal.TemporalAdjusterTemporalAdjusterjava.lang.ComparableComparablejava.io.SerializableSerializableLogicBig

Method:

public boolean isAfter(Year other)

Checks if this year is after the specified year.


Examples


package com.logicbig.example.year;

import java.time.Year;

public class IsAfterExample {

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.isAfter(y);
System.out.println(b);

boolean b2 = y.isAfter(y2);
System.out.println(b2);
}
}

Output

2011
2017
true
false




See Also