exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 156 discussion

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

Given this code for the classes MyException and Test:

What is the result?

  • A. A
  • B. AB
  • C. A compile time error occurs at line n1.
  • D. B
  • E. I
Show Suggested Answer Hide Answer
Suggested Answer: E 🗳️

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
jackymak
11 months, 2 weeks ago
Selected Answer: E
class MyException extends RuntimeException { }; public class Test { public static void main(String[] args) { try { method1(); } catch (MyException ne) { System.out.print("A"); } } public static void method1() { try { throw 3 > 10 ? new MyException() : new IOException(); } catch (IOException ie) { System.out.println("I"); }catch(Exception re ){ System.out.println("B"); } } }
upvoted 2 times
...
Hirushi
1 year, 4 months ago
Compile error at first catch block (Exception 'java.io.IOException' is never thrown in the corresponding try block)
upvoted 2 times
yyfabc
1 year, 2 months ago
no compiling error in my side but it does create warning in my code from VSCODE
upvoted 1 times
...
...
iSnover
1 year, 9 months ago
Selected Answer: E
The answer is the letter E, in Try-Catch it falls into the false one that prints "I" and it's all right that it passes smoothly in the execution.
upvoted 3 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 ...