递归产生StackOverflowError
package com.guoba.digui; public class Demo01 { public void A(){ A();//自己调用自己,递归没用好,产生错误java.lang.StackOverflowError,用Throwable来捕获它,然后程序依旧可以运行 System.out.println("继续运行"); } public static void main(String[] args) { Demo01 demo01 = new Demo01(); try { demo01.A(); } catch (Throwable t) { t.printStackTrace();//打印错误信息 } System.out.println("继续运行"); } }