29 lines
583 B
Markdown
29 lines
583 B
Markdown
|
---
|
||
|
parents:
|
||
|
- "[[Вопросы для собеседование Java]]"
|
||
|
---
|
||
|
```java
|
||
|
public class Main {
|
||
|
|
||
|
public static void main(String[] args) {
|
||
|
System.out.println(testMethod(5, 10));
|
||
|
}
|
||
|
|
||
|
public static int testMethod(int a, int b) {
|
||
|
int result = 10;
|
||
|
try {
|
||
|
if (a == 10) {
|
||
|
return result + 10;
|
||
|
} else if (b == 20) {
|
||
|
return result + 20;
|
||
|
}
|
||
|
return result;
|
||
|
} finally {
|
||
|
result += 15;
|
||
|
System.out.println(result);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
```
|
||
|
***
|