满意答案
x78674181
2013.05.10
采纳率:42% 等级:12
已帮助:14476人
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileNotFoundException;public class Test {
public static void main(String[] args) {
String str="";
BufferedReader br=null;
FileInputStream fis=null;
try {
fis = new FileInputStream("C:/Documents and Settings/Administrator/桌面/Test.java");
br = new BufferedReader(new InputStreamReader(fis));
while((str=br.readLine())!=null) {
System.out.println(str);
}
br.close();
} catch(FileNotFoundException e) {
System.out.println("文件没有找到");
} catch(IOException e) {
}
}
} 把FileInputStream中的路径改一下就行了
11分享举报