只是个错误描述,文案而已  
抛出错误后你就能看到你写的statement 1

解决方案 »

  1.   

    你应该明白,抛出异常就是我不处理这个异常的意思,当然没有影响
    statement 1 只是异常描述而已
      

  2.   

    同上,statement1就是你对异常的描述,用来提示用户产生异常的原因。相当于调用了Exception(String str)带参数的构造函数,来构建一个异常类的对象。
      

  3.   


    比如下面的代码:package lianxi;
    import java.util.Scanner;public class QuotienWithException {
    public static void main(String[] args){
    Scanner input = new Scanner(System.in);

    System.out.print("Enter two integers:");
    int n1 = input.nextInt();
    int n2 = input.nextInt();

    try{
    if(n2 == 0)
    throw new ArithmeticException("Divisor cannot be zero");
                                 //上面的红色字部分代码,我发现不管写什么都没关系
    System.out.println(n1 + "/" + n2 + "is" + n1/n2);

    }
    catch(ArithmeticException ex){
    System.out.println("Exception: an integer" + "cannot be divided by zero");
    }

    System.out.println("Execution continues...");
    }}
      

  4.   


    比如下面的代码:package lianxi;
    import java.util.Scanner;public class QuotienWithException {
    public static void main(String[] args){
    Scanner input = new Scanner(System.in);

    System.out.print("Enter two integers:");
    int n1 = input.nextInt();
    int n2 = input.nextInt();

    try{
    if(n2 == 0)
    throw new ArithmeticException("Divisor cannot be zero");
                                 //上面的红色字部分代码,我发现不管写什么都没关系
    System.out.println(n1 + "/" + n2 + "is" + n1/n2);

    }
    catch(ArithmeticException ex){
    System.out.println("Exception: an integer" + "cannot be divided by zero");
    }

    System.out.println("Execution continues...");
    }}
    红色字是用来描述异常的文本信息
    和MsgBox里写的“Hello World”或者“你好”挺像,所以写什么都一样