完整代码如下,不清楚问题出现在哪,请求指点!
package javashiyaner;
import java.util.Scanner;
public class Javashiyaner {
public static void main(String[] args) {
int year;
int month;
Scanner reader=new Scanner(System.in); System.out.println("请输入年份:");
year=reader.nextInt();
System.out.println("请输入月份:");
month=reader.nextInt();
while(true){ if(month<1||month>12) System.out.println("输入有误请重新输入:"); else break; }
judge(year,month); }
private static void judge(int year, int month) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. }
}
class judge{
public judge(int nian,int yue){
switch(yue){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:System.out.println("该月有31天");break;
case 4:
case 6:
case 9:
case 11:System.out.println("该月有30天");break;
case 2:
if(nian%4==0&&nian%100!=0||nian%400==0)
System.out.println("该月有29天");
else System.out.println("该月有28天");}
}
}