digital-garden/notes/Собеседования/Задачи/Задача 5.md

38 lines
812 B
Markdown
Raw Normal View History

2024-06-13 21:01:37 +03:00
---
parents:
- "[[Вопросы для собеседование Java]]"
---
```java
public class Train {
public static void main(String[] args) {
test();
System.out.println("finish");
}
private static void test() {
try {
method();
} catch (RuntimeException runtimeException) {
System.out.println("catch runtime");
throw new Exception("mega surprise");
} catch (Exception exception) {
System.out.println("catch exception");
} finally {
System.out.println("finally");
}
System.out.println("message");
}
private static void method() {
throw new RuntimeException("surprise");
}
}
```
%%
catch runtime
finally
mega surprise в стектрейсе
%%