//关于栈溢出异常
package com.YiChang;
public class B {
public static void main(String[] args) {
try {
new B().a();
//这是一个栈溢出异常StackOverflowError
//catch()括号里面写的东西就是你想要捕获的异常类型
} catch (StackOverflowError e) {
System.out.println("StackOverflowError");
} finally {
System.out.println("finally");
}
}
public void a() {
b();
}
public void b() {
a();
}
}
控制台输出结果
标签:System,异常,void,Demo68,StackOverflowError,public,直观,捕获 From: https://www.cnblogs.com/CHX249/p/16875511.html