Skip to content

Instantly share code, notes, and snippets.

@johobemax
Created July 8, 2010 02:55
Show Gist options
  • Save johobemax/467589 to your computer and use it in GitHub Desktop.
Save johobemax/467589 to your computer and use it in GitHub Desktop.
/**
* 1~12月の最大日を表示する。
*
* @auther M.Horikawa
*/
public class LastDay
{
public static void main(String[] args)
{
int a = Integer.parseInt(args[0]);
switch(a){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
System.out.println("31日です"); //1,3,5,7,8,10,12の場合
break;
case 4:
case 6:
case 9:
case 11:
System.out.println("30日です"); //4,6,9,11の場合
break;
case 2:
System.out.println("28日または29日です"); //2の場合
break;
default:
System.out.println("入力が間違っています"); //その他の場合
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment