public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
read();
}
public static void read() throws IOException{
BufferedReader in = new BufferedReader(new FileReader( "D:\\text.txt "));
String line = null;
while((line = in.readLine())!=null)
{
System.out.println(line);
}
}
一定要抛异常
这两个方法放在一个class里 你就知道了
用文本流…不要用二进制流…呵呵