throwexception1.java

来自「JAVA的例子程序」· Java 代码 · 共 14 行

JAVA
14
字号
public class ThrowException1{
    int x=4;
    public static void main(String arg[]){
        ThrowException1 c=new ThrowException1();
        
        try{
            if (c.x==4)
               throw new Exception();}catch(Exception e){
            System.out.println(e.getMessage());
            System.out.println(e.toString());
            }
           System.out.println("ok");
            }
    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?