日期:2014-05-20  浏览次数:20781 次

关于数组赋值的问题!! 进来帮下忙啊!!!
count = dao.getAllByPid(IPid).size()/size+1;
int index = 1;
for(int i = 0 ; i<=count; i++){
icount = new Integer[]{};
icount[i] = index;
index++;
}

count是个普通的整形, icount是个数组 为什么icount[i] = index;报错啊?

------解决方案--------------------
icount = new Integer[]{};

实例化数组,但是没有数组 长度,当然会报 ArrayIndexOutOfBoundsException

只要确定长度就好了

还有 icount 这样实例化难道没错???你自己都没有指定他得类型啊,大哥……