import java.util.Scanner;
public class GregorianYear
{
private int year;
public GregorianYear(int a)
{
year = a;
}
public void SetYear()
{
System.out.println( "The year is: " );
Scanner kbd = new Scanner( System.in );
year = kbd.nextInt();
}
public int getYear()
{
return year;
}
public boolean isLeapYear()
{
if ( year > 1852 )
{
if ( year % 100 == 0)
{
if ( year % 400 == 0)
{
return false;
}
else
{
return true;
}
}
}
//Compiler says I need a return statement here.
}
}
I'm programming a (should be) simple program for class, and when I don't have anything there, it says I need a return statement. I assume I can only return a boolean statement, so I enter return isLeapYear();. When I do this, my test method (another file with a public static void main) runs and causes a StackOverflow error at the line where I entered the return statement. What am I doing wrong?