The 1 is an int.
The 2 is an int.
If both operands of the operator/ are integers, the result is an integer too. That is the way of the integer division.
1/2 is thus exactly 0.
1.0 / 2 on the other hand implicitly converts the second operand: 1.0 / 2.0 and then performs floating point division, evaluating to double value 0.5.