switch (1) 썸네일형 리스트형 [Java] if문과 switch문의 비교 (Jump Table) if문에서는 어떠한 조건이 true을 만족할때까지 순차적으로 조건식을 확인해야한다. 그러므로 경우의 수가 많아질수록 조건식(if-else)이 많아져서, 조건식에 대한 처리시간이 많이 걸린다.if (score >= 90) { System.out.println("A");} else if (score >= 80) { System.out.println("B");} else if (score >= 70) { System.out.println("C");} else if (score >= 60) { System.out.println("D");} else { System.out.println("F");} switch문에서는 하나의 조건식으로 많은 경우의 수를 처리할 수 있다. if문 보다 간.. 이전 1 다음