IndexOutOfBoundsException

 ArrayList<Integer> arrayList = new ArrayList<Integer>();  //arrayList.size()
     //Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 10, Size: 0
     //arrayList.get(10);
    String[] s= new String[]{"hello"};  //s.length
    //Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6
    //System.out.println(s[6]);
    HashMap<Integer, String> hashMap = new HashMap<Integer, String>();//hashMap.size()
    //null,它却不会报异常,正常运行,只是返回的结果是null,????????比较比较  区别  区别
    hashMap.get(110);

猜你喜欢

转载自wuxifu001.iteye.com/blog/1820465