讀取特定目錄下txt文檔內容

   



    

public static void main(String[] args)throws IOException {
              String path = "d:/data.txt";
              File file = new File(path);
              BufferedReader in=new BufferedReader(new FileReader(file));
              String str;
              while((str=in.readLine())!=null)  //一行行的讀取內容
                     {
                            System.out.println(str);
                  }
 
       }

發佈了39 篇原創文章 · 獲贊 5 · 訪問量 5萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章