CodesJava

Easy learning with example program codes

Double Data Type in Java

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

Program to declare and use Java primitive double variable.

/**
 * Program to declare and use Java primitive double variable.
 * @author CodesJava
 */
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

 

Please follow and like us:
Posted in Java   








Copyright © 2019 CodesJava DMCA.com Protection Status