QUESTION 29자격증/OCJP_ExamC2018. 7. 24. 03:24
Table of Contents
반응형
QUESTION 29Given:05. class A {06. void foo() throws Exception { throw new Exception(); }07. }08. class SubB2 extends A {09. void foo() { System.out.println("B "); }10. }11. class Tester {12. public static void main(String[] args) {13. A a = new SubB2();14. a.foo();15. }16. }What is the result?A. BB. B, followed by an Exception.C. Compilation fails due to an error on line 9.D. Compilation fails due to an error on line 14.E. An Exception is thrown with no other output.Solution : D
plus imformation
Main.java:14: unreported exception java.lang.Exception;
must be caught or declared to be thrown
a.foo();
^ 1 error
반응형
'자격증 > OCJP_ExamC' 카테고리의 다른 글
QUESTION 31 (0) | 2018.07.24 |
---|---|
QUESTION 30 (0) | 2018.07.24 |
QUESTION 28 (0) | 2018.07.24 |
QUESTION 27 (0) | 2018.07.24 |
QUESTION 26 (0) | 2018.07.24 |
@IT grow. :: IT grow.
#IT #먹방 #전자기기 #일상
#개발 #일상