import java.util.List;
public class Demo06Tips {
public static void main(String[] args) {
try {
List<Integer> list = List.of(1, 2, 3);
System. out. println(list.get(3));
} catch(IndexOutOfBoundsException e){
System.out. println(e);
}
}
}
执行的结果是:java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3
正常的应该是:java.lang.IndexOutOfBoundsException: Index 3 out of bounds for length 3
请大佬解答
Java版本14.0
关的挺快啊