import java.io.*;class test12 {
public static void main(String args[]){
File f1=new File("yqh.txt");
File f2=new File("2009.txt");
FileOutputStream fout=null;
FileWriter fw=null;
PrintStream ps=null;
PrintWriter pw=null;
try{
fout=new FileOutputStream(f1);
fw=new FileWriter(f2);
ps=new PrintStream(fout);
pw=new PrintWriter(fw);
ps.write("FGHFGHF".getBytes());
pw.write("asasdsdfdsffsdf");
// pw.flush();
}catch(Exception e){}
}}为什么ps明明没有刷新的啊,2009那个文件就有数据,而yqh那个文件里没有数据。
public static void main(String args[]){
File f1=new File("yqh.txt");
File f2=new File("2009.txt");
FileOutputStream fout=null;
FileWriter fw=null;
PrintStream ps=null;
PrintWriter pw=null;
try{
fout=new FileOutputStream(f1);
fw=new FileWriter(f2);
ps=new PrintStream(fout);
pw=new PrintWriter(fw);
ps.write("FGHFGHF".getBytes());
pw.write("asasdsdfdsffsdf");
// pw.flush();
}catch(Exception e){}
}}为什么ps明明没有刷新的啊,2009那个文件就有数据,而yqh那个文件里没有数据。
pw.flush();pw.close();