Java – StackOverflowError

StackOverflowError: Thrown when the stack is exhausted due to deep recursion.
Example:

public static void recursiveMethod() {
recursiveMethod();
}
try {
recursiveMethod();
} catch (StackOverflowError e) {
System.out.println("Caught StackOverflowError: " + e.getMessage());
}

No images available.