throwexception.java

来自「java2参考大全上的例子的源码和自己的理解.」· Java 代码 · 共 48 行

JAVA
48
字号
package throwexception;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 *//** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2005</p> * <p>Company: </p> * @author not attributable * @version 1.0 */class ThrowException {  public static void main(String args[]) {    try {      throw new ArithmeticException();    }    catch (ArithmeticException ae) {      System.out.println(ae);    }    try {      throw new          ArrayIndexOutOfBoundsException();    }    catch (ArrayIndexOutOfBoundsException ai) {      System.out.println(ai);    }    try {      throw new          StringIndexOutOfBoundsException();    }    catch (StringIndexOutOfBoundsException si) {      {        System.out.println(si);      }    }  }}

⌨️ 快捷键说明

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