Exam 1z0-808 All QuestionsBrowse all questions from this exam
Question 188

Examine:

Which statement is true?

    Correct Answer: B

    B

Discussion
Bear4TWOption: B

To test: class E1 extends Exception { } class E2 extends RuntimeException { } public class App { public void m1() { System.out.println("m1.Accessed."); throw new E1(); } public void m2() { System.out.println("m2.Accessed."); throw new E2(); } public static void main(String[] args) { int level = 1; App obj = new App(); if (level <= 5 && level >= 3) { obj.m1(); } else { obj.m2(); } } }

iSnoverOption: B

The correct answer is the letter B, in cases of EXCEPTIONS you need to declare in the constructor "throws E1". In the case of a RuntimeException you don't need to.