文件读取

来源:互联网 发布:tcp端口号范围 编辑:程序博客网 时间:2024/05/20 06:55

本地读取

/**
 *
 */
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();
    }
}
}


0 0
原创粉丝点击