Java-Exception Types and Throws Statement

Exception Types Java exceptions are divided into two categories, called checked and unchecked exceptions. All subclasses of RuntimeException class are unchecked exceptions. All other exceptions are checked exceptions.   Checked Exception For checked exceptions, the compiler checks if your program handles them, either by catching them or by specifying (with a throws clause) that the … Read more…

Java-User Defined Exception

User Defined Exception You can create your own exception by extending Exception class. The throw keyword are used while implementing user defined exceptions. Following program demonstrates the use of a user-defined subclass of Throwable class. Note that Exception is a subclass of Throwable and therefore MyOwnException is a subclass of Throwable class. An object of … Read more…