clinitthrow.java
来自「kaffe Java 解释器语言,源码,Java的子集系统,开放源代码」· Java 代码 · 共 54 行
JAVA
54 行
public class CLInitThrow{ static void throwError() { throw new Error(); } static void throwRuntimeException() { throw new RuntimeException(); } public static class ThrowError { static { CLInitThrow.throwError(); } } public static class ThrowRuntimeException { static { CLInitThrow.throwRuntimeException(); } } public static void main(String args[]) { try { new ThrowError(); } catch(Error e) { System.out.println("Caught error"); } try { new ThrowRuntimeException(); } catch(ExceptionInInitializerError eiie) { if( eiie.getException() instanceof RuntimeException ) System.out.println("Caught runtime exception"); } }}/* Expected Output:Caught errorCaught runtime exception*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?