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.


/*from   w  w  w  . j av a2s.c  om*/
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.