아래 코드의 출력값을 작성하시오.
static interface F {
int apply(int x) throws Exception;
}
public static int run(F f) {
try {
return f.apply(3);
} catch (Exception e) {
return 7;
}
}
public static void main(String[] args) {
F f = (x) -> {
if (x > 2) throw new Exception();
return x * 2;
};
System.out.print(
run(f) + run((int n) -> n + 9));
}이 문제는 풀이 화면에서 직접 실행해 풀 수 있어요.
꿈라CBT