Java PrintStream.println(double x)
Syntax
PrintStream.println(double x) has the following syntax.
public void println(double x)
Example
In the following code shows how to use PrintStream.println(double x) method.
//from w ww . ja va 2s . c o m
import java.io.*;
public class Main {
public static void main(String[] args) {
double c = 12345.56;
PrintStream ps = new PrintStream(System.out);
// print a double and change line
ps.println(c);
ps.print("from java2s.com");
// flush the stream
ps.flush();
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »