1 2 3 4 5 6 7
public class PatternInstanceOf { public void foo(Object o) { if (o instanceof String y) { System.out.println(y); } } }