void () { try { if(Math.random() > 0.5) { throw new Ex1(); } if(Math.random() > 0.5) { throw new Ex2(); } if(Math.random() > 0.5) { throw new Ex3(); } } catch(RuntimeException | Ex1 ex) { ex.printStackTrace(); } }