要求:从终端输入一某一年,然后判断该年是否为闰年!
实现源代码:
package Java_001判断是否闰年;
import java.util.Scanner;
public class main{
public static void main(String[] arge){
System.out.print("output:please input yrear:");
int year;
Scanner scanner = new Scanner(System.in);
year = scanner.nextInt();
if (year<0||year>3000){
System.out.println("error");
System.exit(0);
}
if ((year%4==0)&&(year%100!=0)||(year%400==0))
System.out.println(year+" is bissextile");
else
System.out.println(year+" is not bissextile ");
}
}