`

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);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics