import java.util.*;
public class LeapYear
{
public static void main (String[]args)
{
Scanner scan= new Scanner (System.in);
System.out.println("Please enter in the year");
int year=scan.nextInt();
if (year % 4 ==0)
{
{
if (year % 100 ==0);
else
System.out.println("The year,"+year+",is a leap year!");
}
if(year % 400==0)
System.out.println("The year, "+year+",is a leap year!");
}
else
System.out.println("The year, "+year+",is not a leap year!");
}
}
Hey everyone! Above is my code for a leap year program- It seems to work well, except whenever I enter a number such as 3000 or 300, the JVM just stops and shuts the terminal window. Could someone please guide as to why it's not accepting these numbers (Also, please forgive me that my code is not formatted properly- I'm new and trying to do the best I can) NOTE: It is displaying all the right answers when I test 1900, 1996, 2004, 164, and 204 as years. It will simply not accept 300 or 3000. Thanks Again!