Double Java

 
The double data type represents a double-precision 64-bit IEEE 754 floating point.

Range: 1.7e−308 to 1.7e+308

Program to declare and use Java primitive double variable.

/**
 * Program to declare and use Java primitive double variable.
 * @author W3spoint
 */
public class DataTypeDoubleExample {	
  public static void main(String args[]){ 
	//Declare double type variables.
	double d1 = 32.454;
	double d2 = 178.44;
 
        //Print variables value.
        System.out.println("d1 Value :" + d1);
        System.out.println("d2 Value :" + d2);
 
        //Print Sum d1 and d2.
        System.out.print("Sum: ");
        System.out.println(d1 + d2);
  }
}

Output:

d1 Value :32.454
d2 Value :178.44
Sum: 210.894

 

Content Protection by DMCA.com
Please Share