This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.