runTest throws an Exception which is not a subtype of RunTimeException(those which extend are unchecked exception). Therefore TestException is known as a checked exception.
Since test() runs the runTest method, a TextException a checked exception is thrown inside the method. The jave rule is that checked exceptions should be caught or declared. Caught means the exception occur in a try catch block and is caught by catch. Declared means that the method must declare the exception in the throws clause of the method. In this case the exception is not caught therefore runTest must declare a throws TestException(or a type that is a super type).
Originally posted by Barry Gaunt: Otherwise, TestException is an inner class of ExceptionTest (and not static either).
Which isn't a problem, is it?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus