這是我的代碼:我有一個system.out.print錯誤,我不知道爲什麼?
public class Outline {
int rowIndex=62;//hsample number
int colIndex=2;//sample number, will be determined by RNG when I'm done
String val=read1(rowIndex,colIndex);
System.out.print(val);//This is where the error is, I don't know what's wrong with it.
public static final String FILE_NAME = "Copy_of_Words.xls";
public static String read1(int rowIndex, int colIndex){
String value = new String();
HSSFWorkbook wb = null;
try {
wb= new HSSFWorkbook(new FileInputStream(FILE_NAME));
} catch (Exception e){//in here, say what needs to be done
}
HSSFSheet sheet=wb.getSheet("SAT"); //here, user input will determine sheet
HSSFRow row=sheet.getRow(rowIndex-1);
HSSFCell cell=row.getCell(colIndex-1);
DataFormatter formatter = new DataFormatter();
value = formatter.formatCellValue(cell);
return value;
}
}
到底是什麼是System.out.print用(VAL)的問題?我無法弄清楚。我在程序中使用apache和excel,但我不認爲這會導致問題。
錯誤信息究竟是什麼? –
你有什麼錯誤?它是編譯時間還是運行時間?如果運行時添加異常堆棧跟蹤 –
*永遠不會*在一個問題「我有一個錯誤」,而不會說出那個錯誤是什麼。請參閱http://tinyurl.com/so-list –