Java.io.PrintWriter.println float() 方法


Java.io.PrintWriter.println float() 方法

package com.codingdict;



import java.io.*;



public class PrintWriterDemo {



   public static void main(String[] args) {

      float f = 123.456f;



      // create a new writer

      PrintWriter pw = new PrintWriter(System.out);



      // print float

      pw.println(f);

      pw.println(987.765f);



      // flush the writer

      pw.flush();

   }

}