import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Snippet {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(new File("D:\\cacm.all"))));
String has = null;
if ((has = br.readLine()) != null) {
System.out.println(has);
}
br.close();
}
}
------解决思路----------------------
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Snippet {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(new File("D:\\cacm.all"))));
String has = null;
while((has = br.readLine()) != null) {
System.out.println(has);
}
br.close();
}
}
草 不信 显示不错来 红。。