解决方法:加入try catch
这个是编程规范,记住!
public static void main(String args[])
{try
{
File file = new File("F:/java_workspace/EthernetFramePacking/南开简介.txt");
if(file.isFile() && file.exists())
{
FileReader fr = new FileReader(file);
System.out.println("file exists");
}
else
{
System.out.println("file doesn't exist");
}
}
catch (Exception e)
{
System.out.println("读取文件内容出错");
e.printStackTrace();
}
}