class Test { interface F { void m() throws T; } void m1() { } void m2() throws ClassNotFoundException { } void m3() throws Exception { } void foo1(F f) throws K { } void foo2(F f) throws K { } { foo2(()->{}); foo2(()->{ throw new ClassNotFoundException(); }); foo2(this::m1); foo2(this::m2); foo1(()->{ throw new ClassNotFoundException(); }); foo1(()->{ throw new Exception(); }); foo1(this::m2); foo1(this::m3); } }