GitHunt
YO

yogeshkumarsaini/Leap-Year-Checker

A beginner-friendly Java console application that checks whether a given year is a leap year using Object-Oriented Programming (OOP), loops for multiple inputs, and exception handling for invalid user input.

๐Ÿ“… Leap Year Checker

A console-based Leap Year Checker built using Java and Object-Oriented Programming (OOP) principles.
This beginner-friendly project allows users to check multiple years in a loop, handles invalid inputs gracefully using exception handling, and follows clean code practices.


๐Ÿš€ Features

  • โœ… Check whether a year is a leap year
  • ๐Ÿ” Loop to check multiple years in one run
  • ๐Ÿงฑ OOP-based design (separate logic and UI)
  • ๐Ÿšซ Exception handling for invalid inputs
  • โŒจ๏ธ User input using Scanner
  • ๐Ÿงผ Clean, readable, and beginner-friendly code

๐Ÿง  Leap Year Rules

A year is a Leap Year if:

  • It is divisible by 400, OR
  • It is divisible by 4 but not divisible by 100

๐Ÿ› ๏ธ Technologies Used

  • Java
  • OOP Concepts
  • Exception Handling
  • Scanner (User Input)

๐Ÿ“‚ Project Structure

LeapYearChecker/
โ”‚
โ”œโ”€โ”€ LeapYearService.java // Business logic
โ”œโ”€โ”€ LeapYearCheckerApp.java // Main application
โ””โ”€โ”€ README.md

โ–ถ๏ธ How to Run

  1. Clone the repository:
    git clone https://github.com/yogeshkumarsaini/LeapYearChecker.git
  2. Navigate to the project folder:
    cd LeapYearChecker
  3. Compile the program:
    javac LeapYearCheckerApp.java
  4. Run the application:
    java LeapYearCheckerApp

๐Ÿงช Sample Output

๐Ÿ“… Leap Year Checker

Enter a year: 2024
2024 is a Leap Year โœ…

Do you want to check another year? (y/n): y

Enter a year: 1900
1900 is NOT a Leap Year โŒ

๐Ÿงฉ Concepts Covered

  • ifโ€“else conditions

  • Modulus operator %

  • Methods

  • Classes & Objects (OOP)

  • Loops

  • Exception handling

  • User input with Scanner


    ๐Ÿ“Œ Future Enhancements

  • ๐Ÿ“œ Store checked years in a list

  • ๐Ÿ“Š Display leap year history

  • ๐Ÿงช Add JUnit test cases

  • ๐Ÿ–ฅ๏ธ GUI version using Swing/JavaFX