The java.util.Date.after() method is used to check whether the current instance of the date is after the specified date.
Parameter: It takes only one parameter specifiedDate of data type Date. This is the date which is to be checked in comparison to the instance of the date calling the function.
Return Value: The return type of this function is boolean. It returns true if current instance of the date is strictly larger than the specifiedDate. Otherwise it returns false.
Exceptions: If the specifiedDate is null, this method will throw NullPointerException when called upon.
Below programs illustrate after() method in Date class:
Is currentDate after date one : true
Program 2: To demonstrate java.lang.NullPointerException
Passing null as parameter : Exception: java.lang.NullPointerException
- Date before() method in Java with Examples
- HijrahChronology date() method in Java with Example : Set - 2
- Date from() method in Java with Examples
- HijrahChronology date() method in Java with Example : Set - 1
- Date toString() method in Java with Examples
- DateFormat format(Date obj) method in Java
- Date toInstant() Method in Java with Examples
- Date clone() method in Java with Examples
- Date equals() method in Java with Examples
- Date hashCode() method in Java with Examples
- Date setTime() method in Java with Examples
- Date getTime() method in Java with Examples
- Date compareTo() method in Java with examples
- New Date-Time API in Java 8
- Date class in Java (With Examples)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : ManasChhabra2