Java Reference
In-Depth Information
{
public
PowerFailureException()
{
super
("Power Failure!");
}
public
PowerFailureException(String message)
{
super
(message);
}
}
13.
public class
TooMuchStuffException
extends
Exception
{
public
TooMuchStuffException()
{
super
("Too much stuff!");
}
public
TooMuchStuffException(String message)
{
super
(message);
}
}
14.
ExerciseException invoked with an argument.
Do Be Do
15.
Test exception thrown!!
Test Exception thrown!
Message is Test Exception thrown!
16.
try block entered:
MyException: Hi Mom!
End of example.
17. The output would be the same.
18. The output would then be
try block entered:
Leaving try block.
End of example.
19.
41.9
DoubleException thrown!
20. Yes, you can define an exception class as a derived class of the class
IOException.
21.
Second catch.
End of exercise.