[Java] How to cause a StackOverflowError

Quackster

a devbest user says what
Aug 22, 2010
1,763
1,235
Hello..

The simple java code is this

Code:
public class Test
{
    public static void main(String[] args)
	{
        Test.main(args);
    }
}

Then main() will keep calling itself, getting deeper and deeper, and when the space used to keep track of what functions you're in is filled up, you get the stack overflow error.

Good luck :up:

PS: @sauce
 

Users who are viewing this thread

Top