public class BoxedToNarrower { public static void main(String[] args) { Integer boxed = 300; if (boxed instanceof byte b) System.out.println("fits a byte: " + b); // Integer to byte is not allowed } }