Hello,
I am a beginner of java. I wrote this code. When I run it in eclipse, I get an error: java lang null point exception. It does not tell me which line I have wrong code. Please advise on how to fix it.
int TotalCol; int TotalRow; TotalCol = 0; TotalRow = sheet.getLastRowNum(); TotalCol = sheet.getRow(0).getLastCellNum(); System.out.println("row " + TotalRow + " col " + TotalCol); int resultcol = 0; for(int col = 0;col<=TotalCol;col++){ HSSFRow row1 = sheet.getRow(0); System.out.println("column names " + row1.getCell(col).toString() ); if("result".equalsIgnoreCase(row1.getCell(col).toString().trim())) { resultcol = col; System.out.println("result column number " + resultcol ); } }