String s = null;
File file=new File("similarMatric.txt");
if(file.isFile()){
System.out.println("open the file");
}else{
System.out.println("can't open the file");
}
FileReader input=new FileReader(file);
BufferedReader br=new BufferedReader(input);
try {
s=br.readLine();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
while(s!=null){
s=br.readLine();
//System.out.println(s);
}
try {
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
java文件的读取
最新推荐文章于 2022-09-24 16:45:36 发布