Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java Arrays
  • Java Strings
  • Java OOPs
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Java MCQs
  • Spring
  • Spring MVC
  • Spring Boot
  • Hibernate
Open In App
Next Article:
Year isLeap() method in Java with Examples
Next article icon

Year isLeap() method in Java with Examples

Last Updated : 27 Nov, 2018
Comments
Improve
Suggest changes
Like Article
Like
Report
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: Java
// Program to illustrate the isLeap() method  import java.util.*; import java.time.*;  public class GfG {     public static void main(String[] args)     {         // Create first Year object         Year firstYear = Year.of(2016);          // Check if this year object's value is         // a leap year or not         System.out.println(firstYear.isLeap());     } } 
Output:
  true  
Program 2: Java
// Program to illustrate the isLeap() method  import java.util.*; import java.time.*;  public class GfG {     public static void main(String[] args)     {         // Create first Year object         Year firstYear = Year.of(1990);          // Check if this year object's value is         // a leap year or not         System.out.println(firstYear.isLeap());     } } 
Output:
  false  
Reference: https://docs.oracle.com/javase/8/docs/api/java/time/Year.html#isLeap--

Next Article
Year isLeap() method in Java with Examples

B

barykrg
Improve
Article Tags :
  • Misc
  • Java
  • Java-Functions
  • Java-time package
  • Java-Year
Practice Tags :
  • Java
  • Misc

Similar Reads

    Year isAfter() method in Java with Examples
    The isAfter() method of Year class in Java is used to check if this current Year object is after the Year specified as parameter to this method. Syntax: public boolean isAfter(Year otherYear) Parameter: It accepts a single parameter otherYear with which the current Year object is to be compared. Ret
    2 min read
    Year isBefore() method in Java with Examples
    The isBefore() method of Year class in Java is used to check if this current Year object is before the Year specified as parameter to this method. Syntax: public boolean isBefore(Year otherYear) Parameter: It accepts a single parameter otherYear with which the current Year object is to be compared.
    2 min read
    YearMonth isLeapYear() method in Java with Examples
    The isLeapYear() method of YearMonth class in Java is used to check if the year in this YearMonth object is a leap year or not. 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: publ
    2 min read
    Year of() method in Java with Examples
    The of() method of Year class in Java is used to return an Year instance. It accepts an year according to the proleptic ISO calendar system and returns an instance of Year with the specified isoYear. Syntax: public static Year of(int isoYear) Parameter: It accepts a single integral value isoYear as
    1 min read
    Year get() method in Java with Examples
    get() method of the Year class used to get the value for the specified field passed as parameter from this Year as an integer value. This method queries this year for the value of the field and the returned value will always be within the valid range of values for the field. When the field is not su
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences