判断某年是否是闰年
import java.util.Scanner;
import javax.swing.JOptionPane;
public class LeapYear {
public static void main(String []args)
{
String yearsString = JOptionPane.showInputDialog("输入年份");
int year = Integer.parseInt(yearsString);
if (year % 4 == 0 && year % 100!=0||year%400==0) {
JOptionPane.showMessageDialog(null, "是闰年");
}
else {
JOptionPane.showMessageDialog(null, "不是闰年");
}
}
}
补充:软件开发 , Java ,