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.
[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