Java.io.PrintStream.println() 方法


Java.io.PrintStream.println() 方法

package com.codingdict;



import java.io.*;



public class PrintStreamDemo {



   public static void main(String[] args) {



      // create printstream object

      PrintStream ps = new PrintStream(System.out);



      // print this string

      ps.print("This is a String");



      // print new line

      ps.println();



      // print a new string

      ps.println("New line");



      // flush the stream

      ps.flush();

   }

}