public class ConstantAssignment { void dd(Double i) { switch (i) { case 1.0 -> System.out.println(1); default -> throw new IllegalStateException("Unexpected value: " + i); } } void dd2(Long i) { switch (i) { case 1L: System.out.println(1); default: throw new IllegalStateException("Unexpected value: " + i); } } }