2010-12-19 22:23:19 +00:00
|
|
|
public class StackOverflow {
|
2011-01-26 00:13:59 +00:00
|
|
|
private static int test1() {
|
|
|
|
return test1() + 1;
|
2010-12-19 22:23:19 +00:00
|
|
|
}
|
|
|
|
|
2011-01-26 00:13:59 +00:00
|
|
|
private static int test2() {
|
|
|
|
return test3() + 1;
|
2010-12-19 22:23:19 +00:00
|
|
|
}
|
|
|
|
|
2011-01-26 00:13:59 +00:00
|
|
|
private static int test3() {
|
|
|
|
return test2() + 1;
|
2010-12-19 22:23:19 +00: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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|