private static final String FILENAME = "c:\\temp\\out.txt";

     PrintWriter pw = null; try { pw = new PrintWriter(FILENAME); pw.println("hello this is ross speaking"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { pw.close(); }

 

PrintWriter 源码:

/*      */   public PrintWriter(String paramString)
/*      */     throws FileNotFoundException
/*      */   {
/*  157 */     this(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(paramString))), false);
/*      */   }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-06-19
  • 2021-08-06
  • 2022-01-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
相关资源
相似解决方案