Problem with My Leap Year Calculation

Hello guys ,,, how r u?

Guys i need a quick help with my leap year calculation...

what i did is this :

Code :

public static boolean isLeapYear(int year) {
if ((year % 4 == 0) && (year % 100 !== 0) && (year % 400 == 0))
{
return true;
}
else if {
return false;
}

it gives me an error and says:

missing return statement & illegal start of expression

:-L

HELP !

Re: Problem with My Leap Year Calculation

Code java:

public static boolean isLeapYear(int year) {
boolean leap = false;
if ((year % 4 == 0) && (year % 100 !== 0) && (year % 400 == 0))
{
leap = true;
}
return leap;
}

try that. it should work but i am not possitive as i do not have access to a computer with a jdk. If it does not work i shall try it at 12 ish and repost with a working code.

Re: Problem with My Leap Year Calculation

Didn't work

the same

illegal start of expression & it is giving me errors

Re: Problem with My Leap Year Calculation

Code java:

public static boolean isLeapYear(int year) {
boolean leap = false;
if ((year % 4 == 0) && (year % 100 != 0) && (year % 400 == 0))
{
leap = true;
}
return leap;
}

The symbol == means equal to and != means not equal to and the code you had written had !== meaning not equal to equal. (doesnt make much sence in english either. )

Re: Problem with My Leap Year Calculation

you could keep your original code also it would work as long as you fix the !== to !=