📄 judge.java
字号:
import java.io.*;
public class judge {
public static void main(String args[]) throws IOException{
String s;
final String p = new String("bye");
InputStreamReader ir;
BufferedReader in;
ir = new InputStreamReader(System.in);
in = new BufferedReader(ir);
do{
System.out.println();
System.out.print("please input one year,press 'bye' to quit(1000~9999):");
s = in.readLine();
if (s.equals(p))
break;
else{
System.out.println();
System.out.println("the year is:" + s);
int i = Integer.parseInt(s);
if ((i % 4) == 0 && (i % 100) != 0 || (i % 400 == 0)) /* 判断闰年 */
System.out.println("the year " + i + " is leap ");
else
System.out.println("the year " + i + " is not leap");
System.out.println();
}
} while (s.length() == 4 ); /* 对非法数据判断并警告 */
if (s.length() != 4 && ! s.equals(p) )
System.out.println("WARN:it must be from 1000 to 9999 OR you have entered a invalid data,please check out");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -