exam questions

Exam 1z0-808 All Questions

View all questions & answers for the 1z0-808 exam

Exam 1z0-808 topic 1 question 189 discussion

Actual exam question from Oracle's 1z0-808
Question #: 189
Topic #: 1
[All 1z0-808 Questions]

Examine:

Which statement is true?

  • A. The program prints m1.Accessed.
  • B. The program fails compile due to the unhandled E1 exception.
  • C. The program prints m2.Accessed.
  • D. The program fails to compile due to the unhandled E2 exception.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Bear4TW
2 months, 1 week ago
Selected Answer: 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(); } } }
upvoted 1 times
...
iSnover
1 year, 3 months ago
Selected Answer: 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.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago