switch1 4. 조건문(if, switch, 삼항 연산자) If문 조건이 true인 경우에 코드블럭 실행 public class If1 { public static void main(String[] args) { int age = 20; if (age >= 18) { System.out.println("성인입니다."); } if (age = 18) { System.out.println("성인입니다."); } else { System.out.println("미성년자 입니다."); } } } 불필요한 조건 검사를 줄여 .. 2024. 1. 15. 이전 1 다음