nerdexam
Oracle

1Z0-809 · Question #276

1Z0-809 Question #276: Real Exam Question with Answer & Explanation

Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #276. The question stem and answer options stay visible for context.

Question

QUESTION 301 Given class UserException extends Exception { } class AgeOutOfLimitException extends UserException { } and the code fragment: public class App { public static void doRegister (String name, int age) throws UserException, AgeOutOfLimitException { if (name.length () < 60) { throw new UserException (); } else if (age > 60) { throw new AgeOutOfLimitException (); } else { System.out.println("User is registered."); } } public static void main (String [ ] args) throws UserException { App t = new App (); t.doRegister("Mathew", 60); } } What is the result?

Options

  • AUser is registered.
  • BAn AgeOutOfLimitException is thrown.
  • CA UserException is thrown.
  • DA compilation error occurs in the main method.

Unlock 1Z0-809 to see the answer

You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 1Z0-809 Practice