Is it possible for a non-recursive code to cause `StackOverflowError`?

Question

Grade: Education Subject: Support
Is it possible for a non-recursive code to cause `StackOverflowError`?
Asked by:
70 Viewed 70 Answers

Answer (70)

Best Answer
(264)
While less common, a `StackOverflowError` can occur in non-recursive code if there's a very deep, albeit linear, chain of method calls. This could happen in complex frameworks or deeply nested object traversals that repeatedly invoke new methods without returning.