⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excise0326.java

📁 一个很小的JAVA编程,适用于初级学习JAVA语言的同学学习,简单易懂
💻 JAVA
字号:
class Excise0210{
   private int year;
   public void set(int y){year=y;}
   public boolean isLeap(){
      if(year%400==0||(year%400!=0&&year%4==0)) return true;
      else return false;
   }
}
class Excise0326{
   static int dayInMonth(int y, int m){
      int D;
      Excise0210 Y=new Excise0210();
      Y.set(y);
      switch(m){
        case 2: if(Y.isLeap()==true) D=29;else D=28; break;
        case 1:
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12: D=31; break;
        case 4:
        case 6:
        case 9:
        case 11: D=30; break;
        default: System.out.println("Unvalid month!");D=0;
        }
   return D;}
 
   public static void main(String args[]){
      int day=dayInMonth(200400,2);
      System.out.println("it has "+day+" days.");
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -