public class Main { public void test(String msg) { switch (msg) { case "foo" -> { String ba = "ba"; System.out.println(ba + "r"); } } } }