This tutorial is going to teach you the coding for checking whether a year is a leap year or not. Here, we have taken the year 2000. So define an integer n=2000 in the class "Leapyear" and now apply "if else" condition. As we know leap year is divided by the integer 4 and so applying if condition as n/4=0, then "n" is a leap year. Now in the System.out.println write the message that the year is a leap year. Again applying "else" condition the output will be that the year is not a leap year.
Here is the code of program:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: February 11, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles