Posts

Showing posts with the label use of runtime exception

Some tips for exception .......

                                                      TIP OF THE DAY For exception generally to make the class an exception class we write extends Exception.  As we see we write extends exception here in the class we have throw catch and all usual process. for any exception we have to write its try and catch when we write extends exception as exception is the base class . But when we write extends RuntimeException then we didnt need to write try or catch block as its control when having an exception goes to the throwable class the base class of the exception class. With unchecked exceptions calling code method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught. As the calling method may not handle RuntimeException, one needs to be...