java.lang.IndexOutOfBoundsException,数组越界

来源:互联网 发布:天池大数据 编辑:程序博客网 时间:2024/05/21 08:01

取数组里的值时,下标超出数组的长度。

例如:

public static void main(String[] args) throws UserException, Exception {

ArrayList<String> arraylist = new ArrayList<String>();
arraylist.add("1");
System.out.println(arraylist.get(1));

  }

 java.lang.IndexOutOfBoundsException


0 0