nerdexam
Oracle

1Z0-804 · Question #46

Given: And the command-line invocation: Java Tracker 12 11 What is the result?

The correct answer is B. class InvalidAgeException. The second argument 11 makes the program to throw an InvalidAgeException due to the line: throw new InvalidAgeException ();

Exceptions and Assertions

Question

Given:

And the command-line invocation:

Java Tracker 12 11 What is the result?

Exhibit

1Z0-804 question #46 exhibit

Options

  • AGeneral category
  • Bclass InvalidAgeException
  • Cclass java.lang.IllegalArgumentException
  • Dclass java.lang.RuntimeException

How the community answered

(30 responses)
  • A
    17% (5)
  • B
    70% (21)
  • C
    3% (1)
  • D
    10% (3)

Explanation

The second argument 11 makes the program to throw an InvalidAgeException due to the line: throw new InvalidAgeException ();

Topics

#custom exception#exception hierarchy#throw#catch

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice