| 
 
| 今天写程序的时候遇到了IndexOutOfBoundsException异常,解决不了,IndexOutOfBoundsException是什么异常? 废话不多说,先贴出代码:
 import java.util.ArrayList;
 public class Test1
 {
 public static void main(String[] args)
 {
 ArrayList<String> array = new ArrayList<String>();  array.add("hello");
 array.add("itcast");
 array.add("abc");
 array.add("world");  int size = array.size();  for(int x=0; x<size; x++)
 {
 if("abc".equals(array.get(x)))
 {
 array.remove(x);
 
 }
 }
 }
 }
 
 异常提示:
 Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
 
 | 
 |