Java double keywordThe Java double keyword is a primitive data type. It is a double-precision 64-bit IEEE 754 floating point. It is used to declare the variables and methods. It generally represents the decimal numbers. Points to remember
Examples of Java double keywordExample 1Let's see a simple example to display double type variable. Output: num: 5.5 Example 2In this example, we provide integer value to double variable. Here, compiler implicitly typecast integer to double and display the corresponding value in decimal form. Output: num1: 5.0 num2: 10.0 Example 3Let's see an example to test the bigger decimal value. Output: num1: 5.81216732323433E8 num2: 7.83684987683688 Example 4In this example, we provide float value to decimal variable. Output: num1: 56.34000015258789 num2: 34.0 Example 5In this example, we provide the maximum range of decimal value. Output: num1: 4.9E-324 num2: 1.7976931348623157E308 Example 6In this example, we provide the value in scientific notation Output: num1: 1873.2 num2: 1873.2 Example 7Let's see an example to create a method of the double return type. Output: 62.5
Next TopicJava Keywords
|