宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

代码中使用1表示闰年,0表示不是闰年

public class leap_years {

    public static void main(String[] args) {
        int year = Integer.parseInt(args[ 0]);
        int leap;
        if(year%4==0)
            {
                if(year%100==0){
                    if(year%400==0)
                        leap=1;
                    else
                        leap=0;
                    }
                else
                    leap=1;
            }
        else
            leap=0;
       
        if(leap==1)
            System.out.println(year+”年是闰年”);
        else
            System.out.println(year+”年不是闰年”);
    }
}
1、然后运行为配置

判断闰年-风君雪科技博客

2、输入年份

判断闰年-风君雪科技博客

3、然后点击下面的运行

判断闰年-风君雪科技博客