apache poi,NPE

时间:2014-02-15 17:37:25

标签: java apache-poi

我的主要看起来像这样:

    public static void main(String[] agrv) throws IOException{


            Sheet AdditveWs=inputWb.getSheet("Additive List");
            int r1=AdditveWs.getLastRowNum()+1;
            list1=new AdditiveInformation[r1]; 
            fillAddInfoObj(AdditveWs,r1,list1);

            finalOutput(list1);

    }

fillAddInfoObj(AdditveWs,r1,list1)如下所示:

public static void fillAddInfoObj(Sheet ws, int r,AdditiveInformation[] list1) throws IOException{

    System.out.println(r);
    list1=new AdditiveInformation[r];

    for(int i=0;i<r;i++){
        Row row=ws.getRow(i);
        list1[i]=new AdditiveInformation();
        list1[i].readAdditiveName(row);

    }


}

最后finalOutput(list1)如下所示:

public static void finalOutput(AdditiveInformation[] list1){

        **for(AdditiveInformation x: list1)**
            x.output();
    }

我在finalOutput()函数的星号行上得到了一个java null点异常, 谁能告诉我为什么?

0 个答案:

没有答案