Java.io.PrintWriter.print double() 方法


Java.io.PrintWriter.print double() 方法

package com.codingdict;



import java.io.*;



public class PrintWriterDemo {



   public static void main(String[] args) {

      double d = 1234.567;



      // create a new writer

      PrintWriter pw = new PrintWriter(System.out);



      // print double

      pw.print(d);



      // change the line

      pw.println();



      // print another double

      pw.print(987.654);



      // flush the writer

      pw.flush();

   }

}