不确定你要做什么,但你可以简单地从自己调用一个方法(它被称为 递归):
void recursiveMethod() {
System.out.println("Called the recursive method");
recursiveMethod();
}
Run Code Online (Sandbox Code Playgroud)
调用该方法将打印"Called the recursive method"行,直到出现StackOverflowError.
| 归档时间: |
|
| 查看次数: |
7236 次 |
| 最近记录: |