我不确定“句柄”是什么意思。
您当然可以捕获该错误:
public class Example { public static void endless() { endless(); } public static void main(String args[]) { try { endless(); } catch(StackOverflowError t) { // more general: catch(Error t) // anything: catch(Throwable t) System.out.println("Caught "+t); t.printStackTrace(); } System.out.println("After the error..."); }}但这很可能是个坏主意,除非您确切地知道自己在做什么。



