What does "double" do in java? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does "double" do in java?

Variables

22nd May 2019, 9:25 PM
Enadiz
Enadiz - avatar
3 Answers
+ 7
*Taken from the JAVA lesson: - double: for floating-point or real numbers with optional decimal points and fractional parts in fixed or scientific notations, such as 3.1416, -55.66. In other words, it's used for declaring decimal numbers (the ones with dots in between)... You've got examples above. *Program examples using "double": ---------------------------------------------- ... double pi=3.14; System.out.println(pi); ... °Output: 3.14 ---------------------------------------------- ... double n=5; System.out.println(n); ... °Output: 5.0 ----------------------------------------------
22nd May 2019, 10:20 PM
Bodan Talev
Bodan Talev - avatar
+ 6
Double is a primitive data type for decimal numbers like 2.5; 1.333; 4.0... https://www.baeldung.com/java-primitives
22nd May 2019, 9:45 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
Thanks
22nd May 2019, 10:54 PM
Enadiz
Enadiz - avatar