⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multicatch.java

📁 Java程序设计实用教程源代码 本书源代码按章分别放置在不同的文件夹中,所有程序均在JDK1.6环境下编译运行正常,除了第13章需要建立ODBC数据源之外,其他程序只要有Java运行环境即可直接运行
💻 JAVA
字号:
public class multiCatch {
  public static void main(String[] args) {
    int i = 0;
    int j = 0;
    try {
      i = Integer.parseInt(args[0]);
      j = Integer.parseInt(args[1]);
      System.out.println(i + "/" + j + " = " + i / j);
    }
    catch (NumberFormatException e) {
      System.out.println("NumberFormatException ");
      System.err.println("Usage: java multiCatch number1 number2");
    }
    catch (ArrayIndexOutOfBoundsException e) {
      System.out.println("ArrayIndexOutOfBoundsException");
      System.err.println("Usage: java multiCatch number1 number2");
    }
    catch (ArithmeticException e) {
      System.out.println("ArithmeticException ");
      System.err.println(e.getMessage());
    }
    catch (Exception e) {
      System.err.println(e);
      System.err.println(e.getMessage());
    }
  }
}

⌨️ 快捷键说明

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