Java学习 - 黑马(第二部分) - 随堂笔记 - 09_异常
1. 异常
1.1 异常概述
package com.itheima_01;
import java.lang.reflect.Method;
/*
异常
*/
public class ExceptionDemo01 {
public static void main(String[] args) {
method();
}
public static void method() {
int[] arr = {1, 2, 3};
System.out.println(arr[1]);//2
//System.out.println(arr[3]);//ArrayIndexOutOfBoundsException
//数组索引越界异常
System.out.println(arr[2]);
}
}