您的位置:程序门 -> java -> j2se / 基础类



java的io问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


java的io问题[已结贴,结贴人:yqh2009]
发表于:2007-03-08 18:56:35 楼主
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那个文件里没有数据。
发表于:2007-03-08 19:34:501楼 得分:20
ps.flush();ps.close();
pw.flush();pw.close();
发表于:2007-03-08 21:48:592楼 得分:0
我知道这样就会有数据,但是我不明白ps没有刷新,f1里面就有数据呢??


快速检索

最新资讯
热门点击