</pre><pre name="code" class="java">public class Test {
int i=1;
public static void main(String[] args) {
Test test =new Test();
try{
test.study();
//Throwable 是 Exception Error的共同父类
}catch(Throwable e){
System.out.print(test.i );
}
}
//死递归:没有结束条件的递归
public void study(){
//使用计数器计算栈的深度
i++;
study();
}
}
如何测栈的深度
最新推荐文章于 2023-11-19 21:59:02 发布