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

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

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

10条回答
  •  日久生厌
    2021-01-18 05:07

    Every method call that has not yet returned consumes some stack space. (Methods with more local variables consume more space.) A very deep call stack can result in stack overflow.

    Note that on systems with limited memory (mobile devices and such) you don't have much stack space and will run out sooner.

提交回复
热议问题