package ba; import java.io.*; public class huanchong { public static void main(String[] args) { FileInputStream fis=null; InputStreamReader reader=null; BufferedReader buf=null; File f=new File("G:/javakc.txt"); try { fis=new FileInputStream(f); reader=new InputStreamReader(fis); buf=new BufferedReader(reader); String s=null; try { while((s=buf.readLine())!=null){ System.out.println(s); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); }finally{ if(buf!=null){ try { buf.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } }