Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

时间:2023-03-09 07:28:01
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
  • 场景:eclipse中编写java中用到数组

  • 问题:

程序不报错但是运行过程中 终止,显示字样

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

  • 截图:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

  • 原因:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException

这句话表示异常出现在main这个线程里面,错误是java.lang.ArrayIndexOutOfBoundsException。这个错误是你下标获取超出范围了,一般是例如你数组长度为2.但是你获取数组[3].这时候就会报这个错