A good answer might be:

No. In this program, using exceptions seems to make in needlessly complicated.

When to Throw an Exception

Exceptions should be used for exceptional situations outside of the normal logic of a program. In this program an out of range value is likely to be fairly common and should be dealt with using normal if-else type logic.

Another situation where throwing an exception is appropriate is when the problem occurs in the middle of a complicated method that would be made even more complicated if it handled unexpected data as well. Then an exception might be thrown in order to "give up" and go back to the caller (or to a catch{} block at the end of the method).

It is not always obvious when an exception is appropriate. Books on Object Oriented Software Design devote much space on the matter. A large, commercial-quality application program must be consistent in its use of exceptions and in exception handling. Decisions cannot be made on a method-by-method basis.

QUESTION 12:

The exception was thrown and constructed by:

      throw new Exception("Age is: " + age );

If the method that catches this exception uses the exception's getMessage() method, what does it get?

Click Here after you have answered the question