Practice mode Java

What does the JVM throw when a thread needs a larger stack than is permitted, for example through unbounded recursion?

Correct answer B. StackOverflowError

Explanation

The JVM specification states that StackOverflowError is thrown when a computation in a thread requires a larger stack than allowed, and runaway recursion is the usual cause. OutOfMemoryError relates to failing to obtain memory, typically on the heap, or to expand a stack. Being an Error, a stack overflow is normally not caught by applications.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.