★★ Java の宿題ここで答えます Part 61 ★★
at TECH
311:デフォルトの名無しさん
07/06/11 16:42:15
>>307
出題者の意図がつかめないけど無理やり組み込んでみた。
public class MyCalender {
public void printDayOfMonth(int month) {
if(month >= 1 && month <= 12) {
switch(month) {
case 1: case 3: case 5: case 7: case 8: case 10: case 12:
System.out.println("31 days");
break;
case 2: case 4: case 6: case 9: case 11:
System.out.println("30 days");
break;
default:
break;
}
} else {
System.err.println("it's wrong month");
}
}
public static void main(String[] args) {
new MyCalender().printDayOfMonth(3);
}
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4153日前に更新/337 KB
担当:undef