http://www.verejava.com/?id=16992970828178
package com.exception; public class TestException { public static void main(String[] args) { //对运行期异常, 我们可以不捕获, 也可以捕获 int[] scores={60,70,80}; // java.lang.ArrayIndexOutOfBoundsException: 数组越界 try{ //试一试 System.out.println(scores[3]); } catch(ArrayIndexOutOfBoundsException e) { System.out.println("发生了数组越界异常"); } } }
http://www.verejava.com/?id=16992970828178