package com.lovo.homework;
import javax.swing.JOptionPane;
public class RunNian {
public int year;
public void judgeYear(){
String year1=JOptionPane.showInputDialog(null,"输入一个年份");
year=Integer.parseInt(year1);
if(year%400==0||year%4==0&&year%100!=0){
JOptionPane.showMessageDialog(null, "闰年");
}
else{
JOptionPane.showMessageDialog(null, "非闰年");
}
}
public static void main(String[] args) {
RunNian runNian=new RunNian();
runNian.judgeYear();
}
}
import javax.swing.JOptionPane;
public class RunNian {
public int year;
public void judgeYear(){
String year1=JOptionPane.showInputDialog(null,"输入一个年份");
year=Integer.parseInt(year1);
if(year%400==0||year%4==0&&year%100!=0){
JOptionPane.showMessageDialog(null, "闰年");
}
else{
JOptionPane.showMessageDialog(null, "非闰年");
}
}
public static void main(String[] args) {
RunNian runNian=new RunNian();
runNian.judgeYear();
}
}