프로그래밍 언어 활용난도 중상
9번 · 주관식 · 5점
다음 Java 프로그램의 실행 결과를 쓰시오.
public class Main {
interface Operation {
int apply(int value) throws Exception;
}
static int run(Operation operation) {
try {
return operation.apply(3);
} catch (Exception e) {
return 7;
}
}
public static void main(String[] args) {
Operation first = value -> {
if (value > 2) {
throw new Exception();
}
return value * 2;
};
System.out.print(run(first) + run(value -> value + 9));
}
}