Basic programming in java-Leap Year
So for a basic programming class, we have to make a program that tells if
a year is a leap year. We aren't using the scanner method; rather, the
year will be an argument. We have to use a boolean called isLaeapYear(int
year). Here is my code
public class LeapYear{
public static void main(String[ ] args){
int year = readInt();
boolean isLeapYear(int year) = ((year %4 == 0) && (year % 100 !=0) ||
(year % 400 == 0));
if (isLeapYear)
{
return true;
}
else {
return false;
}
}
}
For some reason, it won't compile it says that a ; is expected after
isLeapYear in my boolean line. Any suggestions? Thanks!
No comments:
Post a Comment