class calendar
{
public static void main(String[]args)
{
int yearIn ;
yearIn = Integer.parseInt(args[0]);
showDays(yearIn);
}
static void showDays(int year)
{ int month = 1;
out:
for(;month<13;month++)
{ switch(month)
{
case 1:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 2:
int count =0;
if((year % 4)!=0)
{count = 28;}
else if((year % 100==0)&(year % 400 != 0))
{count = 28;}
else
{count = 29;}
for(int day=1;day<=count;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 3:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 4:
for(int day = 1;day<31;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 5:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 6:
for(int day = 1;day<31;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 7:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 8:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 9:
for(int day = 1;day<31;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 10:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 11:
for(int day = 1;day<31;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
case 12:
for(int day = 1;day<32;day++)
{System.out.println(month+"月"+day+"日");
}
continue;
}
}
}
}
原文:http://www.cnblogs.com/lubocsu/p/4903254.html