Java double type

double type

The double type is a number with a decimal point. The int type is an integer, such as 1 or 3. On the other hand, double type is defined below the decimal point such as 1.2 or 3.5.

Calculation between decimals

[Example]

Main.java


class Main {
  public static void main(String[] args) {
    double number1 = 8.9;
    double number2 = 1.2;
    System.out.println(number1 + number2);
    System.out.println(number1 - number2);
    
  }
}

In the above example, the results would be 11.1 and 7.7.

Recommended Posts

Java double type
Java type conversion
[JAVA] Stream type
Java Optional type
[Java] Data type ①-Basic type
[Java, Kotlin] Type Variance
Java class type field
Type determination in Java
Java study # 1 (typical type)
[Java] About enum type
[Java] Date type conversion
[Java] List type / Array type conversion
Java learning memo (data type)
[Java] Precautions for type conversion
[Java] Type conversion speed comparison
Java study # 7 (branch syntax type)
Java
Java Primer Series (Type Conversion)
Java
[Java] Data type / matrix product (AOJ ⑧ Matrix product)
java (use class type for field)
[Java] Correct comparison of String type
How to use Java enum type
[Java] Express Enum type without using Enum (enumeration) type
Java learning (0)
[Java Siler] About type inference by var
[Java] array
Java protected
[Java] Module
Java array
[Java] Implicit type cast (AOJ10-sum of numbers)
Studying Java ―― 9
Java scratch scratch
Java tips, tips
Java date data type conversion (Date, Calendar, String)
Java methods
Java method
Regarding String type equivalence comparison in Java
Java array
[Java] ArrayDeque
[Easy-to-understand explanation! ] Reference type type conversion in Java
java (method)
Java Day 2018
Java string
java (array)
Java static
Java serialization
java beginner 4
JAVA paid
Use PostgreSQL data type (jsonb) from Java
Studying Java ―― 4
Java (set)
java shellsort
Find out how Java protects type integrity
[Java] compareTo
Studying Java -5
[Java ~ Variable definition, type conversion ~] Study memo
Pass type
java reflexes
java (interface)
☾ Java / Collection