1 2 3 4 5 6 7 8 9 10 11 12 13 14 | package exercise_; import lib.Input; public class Ex12_3_1 { public static void main(String[] args) { int n = Input.getInt( "製品番号" ); String name = switch (n) { case 100 -> "イチゴ" ; case 110 -> "パイン" ; case 120 -> "メロン" ; default -> "??" ; }; System.out.println(name); } } |