文件讀取

本地讀取

/**
 *
 */
package com.liu.interfaceTest;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
/**
 * @author hexi
 *
 */
public class FileInputTest {
public static void  main(String[] arg) {
    BufferedReader br = null;
    try {
         br = new BufferedReader(new FileReader("C:\\Users\\hexi\\Desktop\\11.txt"));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    String line = "";
    try {
        while ((line = br.readLine())!=null) {
            System.out.println(line);
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
}


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