Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Division of double-type numbers in java
Division of double-type numbers in java
4 and 10 are both integer int types, so the result of 4/ 10 is also int, that is, 0. If the result is assigned to double type, it will be converted to double, that is, 0.0d If you want to get the complete result of 0.4, you need to convert 4 or 10 to double type before division.

For example, (double) 4/10;

The operation of numbers in java is according to double.

despise

long

Internationalorganizations (same as international organizations)

tea

byte

For example, the result of float and int operations is float.

The result of int and int operation is int, so when it comes to digital operation in java, you should pay attention to the digital conversion according to the type of result you want.