请问为什么最后的xxxxx无法输出?
本帖最后由 CK.567 于 2019-3-20 13:35 编辑package 输入输出流;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class x1 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
FileWriter fw=new FileWriter("xxx.txt");
fw.write("abcdef");
fw.flush();
FileReader fr=new FileReader("xxx.txt");
int len=0;
char[] c=new char;
while((len=fr.read(c))!=-1)
{
System.out.print(c);
}
System.out.println("xxxxx");
fw.close();
fr.close();
}
}
页:
[1]