PrintWriter.print(double d) has the following syntax.
public void print(double d)
In the following code shows how to use PrintWriter.print(double d) method.
//from w w w . ja va2 s.c o m import java.io.*; public class Main { public static void main(String[] args) { double d = 1234.567; 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(); } }
The code above generates the following result.