Java IO Tutorial - Java PrintStream.print(double d)








Syntax

PrintStream.print(double d) has the following syntax.

public void print(double d)

Example

In the following code shows how to use PrintStream.print(double d) method.

/*w  w  w . j  ava 2s .c o m*/
import java.io.*;

public class Main {

   public static void main(String[] args) {
      double x = 12345678;

      
      PrintStream ps = new PrintStream(System.out);

      // print double
      ps.print(x);

      // flush the stream
      ps.flush();

   }
}

The code above generates the following result.