A simple example of learning java: Perpetual Calendar

Source: Internet
Author: User

A simple example of learning java: Perpetual Calendar

Import java. util. california; public class Calender {public static boolean isRun (int year) // determines whether it is a leap year {if (year % 4 = 0 & year % 100! = 0) | (year % 400 = 0) {return true;} else {return false;} public static int calDay (int year, int mth) // determine the number of days in the month of a year {int days = 31; switch (mth) {case 4: case 6: case 9: case 11: days = 30; break; case 2: if (isRun (year) {days = 29;} else {days = 28;} break;} return days;} public static int calFirstDay (int year, int mth) // determines the day of the week when the first day of a certain year is the day of the week {int FirstDay = 0; // Monday int I = 1901; int tmpday = 0; for (I = 1900; I
 
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.