VOOZH about

URL: https://www.geeksforgeeks.org/java/year-isleap-method-in-java-with-examples/

⇱ Year isLeap() method in Java with Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Year isLeap() method in Java with Examples

Last Updated : 27 Nov, 2018
The isLeap() method of Year class in Java is used to check if this Year object is a leap year or not according to the proleptic calendar system rules. A year is a leap year if it has 366 days in it. According to the proleptic calendar system rules, a year is a Leap year if:
  • If it is divisible by 4.
  • It is not divisible by 100 but it can be divisible by 400.
Syntax:
public boolean isLeap()
Parameter: This method does not accepts any parameter. Return Value: It returns a boolean True value if this Year object's value is a leap year according to the proleptic calendar system rules, otherwise it returns False. Below programs illustrate the isLeap() method of Year in Java: Program 1:
Output:
true
Program 2:
Comment