这是我的代码:我有一个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 –