Hi all, I was reading a few things on the net about how to calculate a leap year in java (and not only for that matter). So something like
...if( year % 400 == 0 || ( year % 4 == 0 && year % 100 != 0 ) )...
So on wikipedia I have found that:
if year is divisible by 400 then is_leap_year else if year is divisible by 100 then not_leap_year else if year is divisible by 4 then is_leap_year else not_leap_year
so what's that
year % 4 == 0 about? the above if should only say
if( year % 400 == 0 && year % 100 != 0 ) ) because if these 2 conditions are satisfied then the year is leap year
Or am I getting it wrong?