Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The java.lang.Exception Class Erroneous code can throw any type of exception. For example, an invalid argument may throw a java.lang.NumberFormatException, and calling a method on a null reference variable throws a java.lang.NullPointerException. All Java exception classes derive from the java.lang.Exception class. It is therefore worthwhile to spend some time examining this class. Among others, the Exception class has the following methods: public String toString() Returns the description of the exception. public void printStackTrace() Prints the description of the exception followed by a stack trace for the Exception object. By analyzing the stack trace, you can find out