exam questions

Exam 1z0-808 All Questions

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

Exam 1z0-808 topic 1 question 187 discussion

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

Given:

Which action fixes the compiler error?

  • A. At line 17, add throws AccessViolationException
  • B. At line 13, add throws LogFileException
  • C. At line 2, replace throws LogFileException with throws AccessViolationException
  • D. At line 7, insert throw new LogFileException ();
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
iSnover
3 months, 1 week ago
Selected Answer: B
The correct answer is the letter B, in cases of EXCEPTIONS you need to declare in the constructor "throws LogFileException". In the case of a RuntimeException you don't need to.
upvoted 3 times
...
shivkumarx
4 months ago
Answer is B Tested: public class App { public static void main(String[] args) { App obj = new App(); try { obj.open(); obj.process(); throw new LogFileException(); } catch (Exception e) { // TODO: handle exception } } void process() throws LogFileException{ System.out.println("Processed"); throw new LogFileException(); } void open() { System.out.println("Opened"); throw new AccessViolationException(); } } class LogFileException extends Exception {} class AccessViolationException extends RuntimeException {}
upvoted 4 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