Home » Java Date after() Method with Examples

Java Date after() Method with Examples

by Online Tutorials Library

Java Date after() Method

The after() method of Java Date class tests whether the date is after the specified date or not.

Syntax:

Parameters

when – a date

Return

It returns a Boolean value true if this date is after the specified date. Otherwise, returns false.

Exception

NullPointerException will be thrown if when is null.

Example 1

Test it Now

Output:

Date 'd' is after Date 'd2' : true  

Example 2

Test it Now

Output:

Date 'd' is after Date 'd2' : false  

Next Topicjava.util.Date

You may also like