Class InstantiationError in Java

0
16
Spread the love
  • 28
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    165
    Shares

Class InstantiationError in Java

InstantiationError is thrown from an application when an application tries to use the java new operator to instantiate an abstract class or an interface.

Normally this error is caught by the compiler. This error can only occur at run time if the definition of the class has incompatibly changed.

The structure of the class InstantiationError is given below:

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

The class InstantiationError also inherits methods from class Object and Throwable.

From Object class From Throwable class
clone() fillInStackTrace()
getClass() getMessage()
notify() printStackTrace()
wait() printStackTrace(PrintWriter)
wait(long, int) getLocalizedMessage()
wait(long) printStackTrace(PrintStream)
equals(Object)
toString()
finalize()
hashCode()
notifyAll()
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 28
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    165
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here