Without using recursion how can a stack overflow exception be thrown?

前端 未结 10 1966
自闭症患者
自闭症患者 2021-01-18 04:19

Without using recursion how can a stack overflow exception be thrown?

10条回答
  •  南笙
    南笙 (楼主)
    2021-01-18 05:22

    If you call enough methods, a stack overflow can occur anytime. Although, if you get stack overflow errors without using recursion, you may want to rethink how you're doing things. It's just so easy with recursion because in an infinite loop, you call a ton of methods.

提交回复
热议问题