arraytroubleagain.java

来自「it contains the practical programs in ou」· Java 代码 · 共 18 行

JAVA
18
字号
import java.lang.reflect.Array;import static java.lang.System.err;public class ArrayTroubleAgain {    public static void main(String... args) {	Integer[] ary = new Integer[2];	try {	    Array.setInt(ary, 0, 1);  // IllegalArgumentException        // production code should handle these exceptions more gracefully	} catch (IllegalArgumentException x) {	    err.format("Unable to box%n");	} catch (ArrayIndexOutOfBoundsException x) {	    x.printStackTrace();	}    }}

⌨️ 快捷键说明

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