Dato il seguente codice:
Ed il seguente output:codice:public class Test { public static void test() throws ArrayStoreException, ArithmeticException, InterruptedException { try { //... try { //... try { //... } finally { System.out.println("inner-inner-finally"); throw new InterruptedException(); } } finally { System.out.println("inner-finally"); throw new ArrayStoreException(); } } finally { System.out.println("finally"); throw new ArithmeticException(); } } public static void main(String[] args) { try { test(); } catch (ArrayStoreException e) { System.out.println("main -> exception: ArrayStoreException"); } catch (InterruptedException e) { System.out.println("main -> exception: InterruptedException"); } catch (ArithmeticException e) { System.out.println("main -> exception: ArithmeticException"); } } }Vorrei capire che cosa ne è delle due eccezioni lanciate all'interno dei due finally annidati. L'output lascia intendere che vengano "scordati", però in che modo e secondo quale logica?codice:inner-inner-finally inner-finally finally main -> exception: ArithmeticException
P.S. Le classi delle eccezioni le ho scelte casualmente con il solo fine che fossero una diversa dalle altre.

Rispondi quotando