double Datatype in Java

Java Programming Language DataTypes in java (Article) DataTypes in java (Program)

2231

  • double data type is a double-precision 64-bit IEEE 754 floating point

  • This data type is generally used as the default data type for decimal values, generally the default choice

  • Double data type should never be used for precise values such as currency

  • Default value is 0.0d

  • Example: double d1 = 123.4

Program:

 public class DoubleDataType {

   public static void main(String []args) {
      // this is declaration and initialization of variable a
	  // datatype is double
	  double a = 123.4;
	  // this is declaration and initialization of variable b
	  // datatype is double
      double b = 6563.4;
      System.out.println(a); // it will print a variable
      System.out.println(b); // it will print b variable

   }
}

Output:

123.4
6563.4
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.