StackOverflowError is the child class of Error in Java, Hence it is an unchecked Exception. StackOverflowError is automatically raised by JVM whenever the programmer tries to perform a recursive method call.
public class StackOverflow {
public static void method1(){
method2();
}
public static void method2(){
method1();
}
public static void main(String[] args) {
method1();
}
}
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