exceptionindexoutof.java

来自「java程序设计源代码」· Java 代码 · 共 14 行

JAVA
14 行
字号
public class ExceptionIndexOutOf{
    public static void main(String[] args)    {
        String friends[]={"lisa","bily","kessy"};
      	try {
      	   for(int i=0;i<5;i++) {
           		System.out.println(friends[i]);
           }
      	} catch(java.lang.ArrayIndexOutOfBoundsException e)  {
           System.out.println("index err");
      	}
      	System.out.println("\nthis is the end");
       }
}

⌨️ 快捷键说明

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