StackOverflowError

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

Leave a Comment