All About Class RuntimeException in Java


RuntimeException is the super class of all Exceptions which can be thrown during the normal operation of the java virtual machine.A method is required to declare in its throws clause.Any subclasses of the RuntimeException that might be thrown during th eexecution of the method but not caught.
In  simple words it is the base class for all exceptions that indicate some kind of programming issue or a bug. They originated as our or client programming using our library improperly. Because the indicate bugs,we virtually never catch a RuntimeException. It occurs during run time and automatically.In our own package we may throw some of the RuntimeExceptions.
The structure of the RuntimeException class is given as :

public class java.lang.RuntimeException extends java.lang.Exception{
//constructor
public RuntimeException();
//constructs an empty RuntimeException object that is an object with no message specified.
public RuntimeException(String message);
//constructs an RuntimeException object with the message specified.

}
 
All About Class RuntimeException in Java All About Class RuntimeException in Java Reviewed by Animesh Chatterjee on September 18, 2018 Rating: 5

No comments:

Powered by Blogger.