我不明白为什么编译器给我以下错误:
Syntax error: insert } to complete ClassBody
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
package sau.se.extractor.excel;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import java.io.File;
import java.io.IOException;
public class ExcelHandler {
public ExcelHandler() {
};
public void printExcelContent() {
Workbook wrk1 = null;
try {
wrk1 = Workbook.getWorkbook(new File(
"C:/Users/Houssem/Downloads/st.xls"));
} catch (BiffException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Sheet sheet1 = wrk1.getSheet(0);
Cell colArow1 = sheet1.getCell(0, 0);
Cell colBrow1 = sheet1.getCell(1, 0);
Cell colArow2 = sheet1.getCell(0, 1);
String str_colArow1 = colArow1.getContents();
String str_colBrow1 = colBrow1.getContents();
String str_colArow2 = colArow2.getContents();
System.out.println("Contents of cell Col A Row 1: \"" + str_colArow1
+ "\"");
System.out.println("Contents of cell Col B Row 1: \"" + str_colBrow1
+ "\"");
System.out.println("Contents of cell Col A Row 2: \"" + str_colArow2
+ "\"");
};
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激
有时,Eclipse无法正确清除错误.你可以尝试清理/重建你的项目(菜单:Project> Clean ..),这通常可以解决问题.
如果错误仍然存在,只需删除它(不开玩笑):
在" 问题 "视图中选择错误并删除它(DEL键或使用上下文菜单).之后刷新或清理项目以查看错误是否再次出现.
| 归档时间: |
|
| 查看次数: |
7418 次 |
| 最近记录: |