首页 > 学院 > 开发设计 > 正文

Java核心代码例程之:ShowFileContent.java

2019-11-18 15:16:36
字体:
来源:转载
供稿:网友

import java.io.*;

// Read a file using BufferedReader.readLine()
public class ShowFileContent
{
   public static void main(String args[]) throws Exception
   {
       FileReader fr = new FileReader("c:/autoexec.bat");
       BufferedReader br = new BufferedReader(fr);
       String line = null;
       
       while ((line = br.readLine()) != null)
          System.out.PRintln(line);
          
       br.close();
   }
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表