public class Test { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("请输入你想知道的年份?"); String s=input.nextLine(); int res=Integer.parseInt(s); Boolean r= isLeapYear(res); System.out.println(r); } public static boolean isLeapYear(int a){ if((a%4==0 && a%100!=0) || a%400==0) { return true; }else{ return false; } } }
原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/275018.html