Java.io.PrintWriter.println() 方法


Java.io.PrintWriter.println() 方法

package com.codingdict;



import java.io.*;



public class PrintWriterDemo {



   public static void main(String[] args) {

      String s = "Hello world.";



      // create a new writer

      PrintWriter pw = new PrintWriter(System.out);



      // print string

      pw.print(s);



      // change the line twice

      pw.println();

      pw.println();



      // print another string

      pw.print("Two lines skipped.");



      // flush the writer

      pw.flush();

   }

}