Java.io.PrintStream.close() 方法


Java.io.PrintStream.close() 方法

package com.codingdict;



import java.io.*;



public class PrintStreamDemo {



   public static void main(String[] args) {

      String s = "Hello World.";



      // create printstream object

      PrintStream ps = new PrintStream(System.out);



      // print our string

      ps.println(s);



      // closing stream

      System.out.println("Closing Stream...");



      // close the stream

      ps.close();

   }

}