To write a number of type double or float, we can directly use the print or println methods:
Example: The following code fragment
double d = 98d;
System.out.println("d = " + d);
float x = 0.0032f;
System.out.println("x = " + x);
prints on the screen
d = 9.8E1 x = 3.2E-3