public class ExceptionLossTest{ public static void main(String[] args){ try { try { throw new Exception("a"); } finally { if (true) { throw new IOException("b"); } System.err.println("c"); } } catch (IOException ex) { System.err.println(ex.getMessage()); } catch (Exception ex) { System.err.println("d"); System.err.println(ex.getMessage()); } } }Результатом его выполнения будет вывод в консоль b. И только. Return в finally тоже затирает другие ретурны
Комментариев нет:
Отправить комментарий