Throwable Class Assignment Help

Assignment Help: >> Exception Types - Throwable Class

Throwable Class:

All exceptions in Java are sub classed from the class Throwable. You must subclass Throwable if you need to create your own exception classes. Most Java programs do not have to subclass their own exception classes.

The given program is the public portion of the class definition of Throwable:

public class Throwable {

public Throwable() ;

public Throwable(String message) ;

public String getMessage()

public String toString() ;

public void printStackTrace() ;

public void printStackTrace(java.io.PrintStream s) ;

private native void printStackTrace0(java.io.PrintStream s);

public native Throwable fillInStackTrace();

}

The constructor takes a string which describes the exception. Later, whenever an exception is thrown, you could call the getMessage() method to get the error string which was reported.

The functions of the Java API and the language itself also throw exceptions. These exceptions could be broken into two classes that are: Error and Exception.

Both the Exception and Error classes are derived from Throwable. An Exception and its subclasses are used to denote conditions which might be recoverable. Error and its subclasses denote conditions which are commonly not recoverable and should cause your applet to terminate.

The several packages involved in the Java Developers Kit throw various types of Exception and Error exceptions, as define in the given sections.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd