package java0822_statement; /* * ê° ìì ë§ì§ë§ ì¼ * 1 3 5 7 8 10 12 => 31 * 4 6 9 11 => 30 * 2 => 28 * * [ì¶ë ¥ê²°ê³¼] * 4ìì ë§ì§ë§ ì¼ì 30ì ëë¤. */ public class Java023_if { public static void main(String[] args) { int month = 4; // ì int lastDay = -1; // ë§ì§ë§ ì¼ //////////////////////////////////////////////////////// if (month == 2) { lastDay = 28; } else if (month == 4 || month == 6 || month == 9 || month == 11) { lastDay = 30; } else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { lastDay = 31; } else { System.out.println("ë¹ì ìì ì¸ ì ë ¥ì ëë¤."); } //////////////////////////////////////////////////////// System.out.printf("%dìì ë§ì§ë§ ì¼ì %dì¼ ì ëë¤.", month, lastDay); } }