# leap year

how to create class for leap year. It is leap year if it is divisible by 4 and 400 but not 100?

October 21, 2010 at 11:39 AM

Hi Friend,

Try the following code:

```import java.util.*;

public class LeapYear{
public static boolean isLeapYear(int year) {

if (year < 0) {
return false;
}
if (year % 4 == 0) {
return true;
}  else if (year % 400 == 0) {
return true;
}
else if (year % 100 == 0) {
return false;
}
else {
return false;
}
}
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("Enter any year:" );
int y = in.nextInt();
LeapYear year = new LeapYear();
if (year.isLeapYear(y)){
System.out.println("It is a leap year.");
}
else{
System.out.println("It is not a leap year.");
}
}
}
```

Thanks

leap year
leap year  how to create class for leap year. It is leap year...(); if (year.isLeapYear(y)){ System.out.println("It is a leap year."); } else{ System.out.println("It is not a leap year
java leap year
whether itis a leap year. Aleap year is an integer greater than 1584...("It is a leap year."); } else{ System.out.println("It is not a leap...java leap year  write a java program that takes an input
Java Leap Year Problem
Java Leap Year Problem  I need help with a writing a program in Java that creates a class Year that contains a data field that holds the number of months in a year and the number of days in a year. It should include a get method
leap year logic - Java Beginners
leap year logic  hi frds.. can u give me logic for leap year..  Hi Friend, Please visit the following link: http://www.roseindia.net/java/beginners/Leapyear.shtml Thanks
Checking whether a year is leap or not
Checking whether a year is leap or not   ... for checking whether a year is a leap year or not. Here, we have taken the year 2000. So...;if else" condition. As we know leap year is divided by the integer 4 and so
Determining If a Year is a Leap Year in Java
Determining If a Year is a Leap Year in Java       Leap Year: Leap Year is the year contains an extra day. In the leap year, February month contains 29 days since normally
leap
leap   Check the given year for leap year (Test Case: 2010, 2012 , 1900
ModuleNotFoundError: No module named 'leap'
ModuleNotFoundError: No module named 'leap'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'leap' How to remove the ModuleNotFoundError: No module named 'leap' error
ModuleNotFoundError: No module named 'leap'
ModuleNotFoundError: No module named 'leap'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'leap' How to remove the ModuleNotFoundError: No module named 'leap' error
ModuleNotFoundError: No module named 'leap'
ModuleNotFoundError: No module named 'leap'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'leap' How to remove the ModuleNotFoundError: No module named 'leap' error
ModuleNotFoundError: No module named 'leap-client'
ModuleNotFoundError: No module named 'leap-client'  Hi, My Python... 'leap-client' How to remove the ModuleNotFoundError: No module named 'leap-client' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'leap-client'
ModuleNotFoundError: No module named 'leap-client'  Hi, My Python... 'leap-client' How to remove the ModuleNotFoundError: No module named 'leap-client' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'leap_gwas'
ModuleNotFoundError: No module named 'leap_gwas'  Hi, My Python... 'leap_gwas' How to remove the ModuleNotFoundError: No module named 'leap... have to install padas library. You can install leap_gwas python with following
ModuleNotFoundError: No module named 'leap-protocol'
ModuleNotFoundError: No module named 'leap-protocol'  Hi, My... 'leap-protocol' How to remove the ModuleNotFoundError: No module named 'leap-protocol' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'leap-server'
ModuleNotFoundError: No module named 'leap-server'  Hi, My Python... 'leap-server' How to remove the ModuleNotFoundError: No module named 'leap-server' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'linggle-leap'
ModuleNotFoundError: No module named 'linggle-leap'  Hi, My Python... 'linggle-leap' How to remove the ModuleNotFoundError: No module named 'linggle-leap' error? Thanks   Hi, In your python
Listing out leap years between certain period
.  As we know a leap year is divisible by 4, define an integer l=n%4. So if 'n' is divisible by 4 or l=0, then the particular year can be a leap year... will be a leap year. For listing out each year write "+n"
ModuleNotFoundError: No module named 'leap-second-client'
ModuleNotFoundError: No module named 'leap-second-client'  Hi, My... named 'leap-second-client' How to remove the ModuleNotFoundError: No module named 'leap-second-client' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'mailpile-leap-adapter'  Hi...: No module named 'mailpile-leap-adapter' How to remove the ModuleNotFoundError: No module named 'mailpile-leap-adapter' error? Thanks   Hi
wrong year
wrong year..ADS_TO_REPLACE_1   I think u are using other calendar Check
How to calculate days in a year
How to calculate days in a year  Hi, How to calculate no of days in a year? I want a program that calculates no of days in a year by specifying year... of calculating days in a year? Thanks
Mysql Year of Date
Mysql Year of Date       Mysql Year of Date is used to return the current year of the table... from 'Mysql Year of Date'. To understand and grasp the example we use
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each... out put . Enter day of birth: 02 Enter month of birth: 10 Enter year of birth
Mysql Date Get Year
Mysql Date Get Year       Mysql Date Get Year is the way of retrieving the current year... 'Mysql Date Get Year'. To understand and grasp this example, we use
Mysql Date Add Year       Mysql Date Add Year explains to add the year to the particular... an example from 'Mysql Date Add Year'. To graspe this example, we use Add
name of year in chinese
name of year in chinese   hello my name kiemtheng i'm come from Cambodia, i would to write java programming to calculate a name of year for each birthday in Chinese but i dont know how to do.   import java.util.
JSP Financial Year Table
JSP Financial Year Table  Im trying to design a financial year table...wherein the user enters the data in the table and the same is updated in backend.i have successfully desinged the page but i have certain doubts in jsp
ModuleNotFoundError: No module named 'week-of-year'
ModuleNotFoundError: No module named 'week-of-year'  Hi, My Python... 'week-of-year' How to remove the ModuleNotFoundError: No module named 'week-of-year' error? Thanks   Hi, In your python
How to Addding 1 Year with PHP
How to Addding 1 Year with PHP  Hi, I am very fresh in PHP language. I trying to create a small application about how to adding 1 year in specific date. Please suggest me. Thanks
one year data science masters
one year data science masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: one year... that I can learn the topic "one year data science masters". Also tell me
1 year data science masters
1 year data science masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year data... can learn the topic "1 year data science masters". Also tell me which
1 year masters in data science
1 year masters in data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... that I can learn the topic "1 year masters in data science". Also tell
data science 1 year masters
data science 1 year masters  Hi, I am beginner in Data Science... science 1 year masters Try to provide me good examples or tutorials links so that I can learn the topic "data science 1 year masters". Also tell me which
data science 1 year course
data science 1 year course  Hi, I am beginner in Data Science... 1 year course Try to provide me good examples or tutorials links so that I can learn the topic "data science 1 year course". Also tell me which
data science one year masters
data science one year masters  Hi, I am beginner in Data Science... science one year masters Try to provide me good examples or tutorials links so that I can learn the topic "data science one year masters". Also tell me
1 year masters in artificial intelligence
1 year masters in artificial intelligence  Hi, I am beginner in Data...: 1 year masters in artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "1 year masters
1 year masters data science
1 year masters data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... can learn the topic "1 year masters data science". Also tell me which
data science 2 year degree
data science 2 year degree  Hi, I am beginner in Data Science... 2 year degree Try to provide me good examples or tutorials links so that I can learn the topic "data science 2 year degree". Also tell me which
machine learning final year project
machine learning final year project  Hi, I am beginner in Data...: machine learning final year project Try to provide me good examples or tutorials links so that I can learn the topic "machine learning final year
final year project on artificial intelligence
final year project on artificial intelligence  Hi, I am beginner... to learn: final year project on artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "final year
final year project artificial intelligence
final year project artificial intelligence  Hi, I am beginner... to learn: final year project artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "final year project
Java converts any given year to Roman Numeral
Java converts any given year to Roman Numeral  Write a program that converts any given year to Roman Numeral
Add year to Date without using Calendar in java
Add year to Date without using Calendar in java  how could i add a year to a date function without using calendar functions
masters in data science 1 year
masters in data science 1 year  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: masters in data science 1 year Try to provide me good examples or tutorials links so
JDBC : Get year from Date
JDBC : Get year from Date In this section, you will learn how to get year from date. Get year from Date : In MySql you can get year from the given Date by using year() function.ADS_TO_REPLACE_1  YEAR(date) : This method returns