[求助]始终提示不能找到FileWriter的构造函
运行的程序如下
import java.io.*;
public class FileWriter{
public static void main(String args[])throws Exception{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw= new BufferedWriter(new FileWriter("line.txt"));
String s;
while(true){
System.out.println("请输入字符串");
System.out.flush();
s=br.readLine();
if(s.length()==0) break;
bw.write(s);
bw.close();
}
}
}
//始终提示不能找到FileWriter的构造函数。
错误提示为;
BufferedWriter bw= new BufferedWriter(new FileWriter("line.txt"));
^
1 error
找不到FileWriter的构造函数
这个错误有点莫名其妙啊
请各位高手帮忙看看问题出在哪?