Что попадет в стандартный поток вывода, если метод tryThis() выбросит IOException?

try {
    tryThis();
    return;
} catch (IOException x1) {
    System.out.println("exception 1");
    return;
} catch (Exception x2) {
    System.out.println("exception 2");
    return;
} finally {
    System.out.println("finally");
}
Explanation
Only one catch block with the most specific matching exception will be executed, in this case it is catch (IOException x1) . Finally block is also executed, as it is executed always.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Продолжайте изучать
тесты по Java
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты