package com.hytc.www;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class Hello {
public static void main(String[] args) {
String fileName = "F:\\javaEEworkspace\\test2\\src\\com\\hytc\\www\\a.txt";
String line;
try {
BufferedReader in = new BufferedReader(new FileReader(fileName));
line = in.readLine();
while(line!=null){
System.out.println(line);
line = in.readLine();
}
in.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
读取文件 java
最新推荐文章于 2018-03-08 16:39:14 发布