package io.test;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.File;
import java.io.IOException;
public class IOTest{
public static void main(String[] args) throws IOException{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("please input filename");
String filename=in.readLine();
readFile(filename);
}
private static void readFile(String filename) throws IOException{
File file=new File(filename);
if(file.exists()&&file.isFile()){
BufferedReader buf=new BufferedReader(new FileReader(file));
String line=null;
while((line=buf.readLine())!=null){
System.out.println(line);
}
buf.close();
}else{
System.out.println("文件不存在");
}
}
}