1. all exceptions are subclasses of .Throwable class. 2. Exceptions of the Exception subclass may be handled in a try/catch block. 3. Exceptions of the Error subclass should never be handled. 4. if a method does not handle an exception it must be declared in the throws clause. the exception declared in the throws clause may be any exception which is a subclass of Exception but not of RuntimeException. Are all the points mentioned above correct ???
hi nikhil, Runtime exceptions can also be put in the throws clause, but it is not of any use, since they are implicitly included!! So, you won't get any compile time/ runtime error, even if you put it in the throws clause. I tried this program:
It works the same way, even if you remove the throws clause of the divide method definition. Hope it's of some use Regards, suresh.
Just the other day, I was thinking ... about this tiny ad: