2010-12-19 15:23:19 -07:00
|
|
|
public class StackOverflow {
|
2011-01-25 17:13:59 -07:00
|
|
|
private static int test1() {
|
|
|
|
return test1() + 1;
|
2010-12-19 15:23:19 -07:00
|
|
|
}
|
|
|
|
|
2011-01-25 17:13:59 -07:00
|
|
|
private static int test2() {
|
|
|
|
return test3() + 1;
|
2010-12-19 15:23:19 -07:00
|
|
|
}
|
|
|
|
|
2011-01-25 17:13:59 -07:00
|
|
|
private static int test3() {
|
|
|
|
return test2() + 1;
|
2010-12-19 15:23:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
try {
|
|
|
|
test1();
|
|
|
|
throw new RuntimeException();
|
|
|
|
} catch (StackOverflowError e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
test2();
|
|
|
|
throw new RuntimeException();
|
|
|
|
} catch (StackOverflowError e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|