If a client can reasonably be expected to recover from an exception, make it a checked exception. If a client cannot do anything to recover from the exception, make it an unchecked exception.
Immanuel Marimuthu wrote:The reason was due to java.lang package
so it was my job to see if its actually thrown or not
Raju Champaklal wrote:if an exception is a checked exception or has any subclasses that are checked exceptions and some are unchecked exceptions....then why does the compiler give that the given exception must be declared to be thrown or caught???
the compile doesnt complain that the exception isnot thrown when it has a unchecked subclass exception then why does the compiler complain when thhat exception is thrown without catching it decalring it to be thrown?
Raju Champaklal wrote:you said that since Exception has a checked Exception subclass and an unchecked exception subclass we can use a try block without actually throwing an exception in the try block since the comipler knows that a runtime exception can be thrown so it doesn check.......but my question is then why do we have to provide a try catch block in the first place....
Raju Champaklal wrote:Exception has both checked and unchecked and unchecked are not checked by the compler so why do we need to catch new Exception().....
Raju wrote:is it true that every class that has both unchecked exceptions and checked exceptions has subclasses will itself be called a checked exception
Raju Champaklal wrote:dude but isnt RuntimeException a subclass of Exception class?