enhanced switch()문
·
Java & Spring/Java
- 기존 swich문switch (value) { case 1: System.out.println("One"); break; case 2: System.out.println("Two"); break; default: System.out.println("Default");} - enhanced swicth문switch (value) { case 1 -> System.out.println("One"); case 2 -> System.out.println("Two"); default -> System.out.println("Default");} ※ enhanced swich문은 단일 표현식만 사용가능