Java Double Example Program

Chapter: Data Types Last Updated: 28-03-2017 17:38:39 UTC

Program:

            /* ............... START ............... */
                
public class JavaDoubleExample {
	public static void main(String[] args) {

		double d = 10.10;
		Double dObj1 = new Double(d);
		System.out.println(dObj1);

		Double dObj3 = new Double("25.34");
		System.out.println(dObj3);
	}
}
                /* ............... END ............... */
        

Output

10.1
25.34

Notes:

  • The double data type in java is a double-precision 64-bit IEEE 754 floating point.
  • java.lang.Double class wraps a value of the primitive type double in an object.
  • Double has a size of 8 bytes IEEE 754. Covers a range from 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative).

Tags

Java, Double

Similar Programs Chapter Last Updated
Java String Example Program Data Types 19-06-2016
Primitive Datatypes In Java Example Data Types 17-06-2016
Enum In Java Example Data Types 28-04-2016
Java Short Example Program Data Types 10-06-2016
Java Long Example Program Data Types 15-07-2016
Java Int Example Program Data Types 06-07-2016
Int Array In Java Example Program Data Types 09-06-2016
Java Float Program Example Data Types 28-03-2017
Java Char Example Program Data Types 28-03-2017
Java Byte Example Program Data Types 28-03-2017
Java Boolean Example Program Data Types 28-03-2017

1