All About InstantiationException in Java



InstantiationException is thrown from the application when the application tries to create an instance of a class using the newInstance() method defined in class Class,but the specified class object can not be instantiated because it is an interface or an abstract class.

The structure of the InstantiationException class is given below:


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

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

No comments:

Powered by Blogger.