【发布时间】:2018-05-09 08:03:04
【问题描述】:
File file = new File("Skill.txt");
Scanner new_sc;
try {
new_sc = new Scanner(file);
while (new_sc.hasNextLine())
System.out.println(new_sc.nextLine());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
我用了try catch方法,对这个方法不熟悉。
【问题讨论】:
-
您的标题和您的代码似乎相反-您的代码正在读取文件
-
顺便说一句,请发布您的堆栈跟踪
-
如果您的问题是您的代码打印了
FileNotFoundException和一堆行信息,那是因为e.printStackTrace()就是这样做的。
标签: java file-handling