首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

poi的EXCEL失误空指针

2013-09-15 
poi的EXCEL出错空指针for (int i 0 i n i++) {if (sheet1.getRow(i).getCell(1).toString()Seque

poi的EXCEL出错空指针
      for (int i = 0; i < n; i++) {
if (sheet1.getRow(i).getCell(1).toString()=="Sequence No") {
rowflag=i;
}
}


Exception in thread "main" java.lang.NullPointerException
at com.cargosmart.vec.Len.POISample.main(POISample.java:54)


在循环时候遇到,这是什么问题。循环没有超过边界。 POI
[解决办法]
有单元格没有值吧
[解决办法]
首页确定sheet1.getRow(i) 不能为null,
sheet1.getRow(i).getCell(1)不能为null,
然后你再可以toString(),
==  这个是不是equals

热点排行