Exam 9: Exception Handling

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Define an exception class called NegativeNumberException.The class should have a constructor with no parameters.If an exception is thrown with this zero-argument constructor,getMessage should return "Negative Number Not Allowed!" The class should also have a constructor with a single parameter of type String.If an exception is thrown with this constructor,then getMessage returns the value that was used as an argument to the constructor.

(Essay)
4.9/5
(45)

The compiler does not complain when the catch or declare rule is ignored.

(True/False)
4.9/5
(28)

A runtime exception is a/an:

(Multiple Choice)
4.9/5
(38)

If you were going to catch an exception of type Exception,where should this catch block be placed within your code?

(Essay)
4.8/5
(36)

When an exception is thrown,the code in the surrounding try block continues executing and then the catch block begins execution.

(True/False)
4.8/5
(42)
Showing 41 - 45 of 45
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)