ExceptionInInitializerError is a child class of Error in Java, Hence it is an unchecked exception. ExceptionInInitializerError is automatically raised by JVM if any Exception occurs during the implementation of static variable assignment or static blocks.
public class ExceptionInInitalizer{
static int x = 10/0;
public static void main(String[] args) {
System.out.println(x);
}
}
Similar Java Tutorials
- Odd Even in Java
- Method to print exception information in Java
- Exception Handling by Using try-catch in Java
- Checked Exception vs Unchecked Exception
- Exception Hierarchy in Java
- Java Exception Handling Interview Questions
- final finally finalize in java
- User Defined Exception in Java
- Exception Handling Keyword in Java
- throw throws in Java
- try with multiple catch block in Java