0
final double integer = 20/100;

If i was to print integer, I would get 0 rather than 0.2

double integer1 = 20/100;

If I was to print integer1, I would get 0.2

final double integer3 = 200/100;

If I was to print integer3 out, I would get 2.0.

Can anyone explain why I get 0 for the first print statement and not 0.2 since its a double, and why it works for the third statement, where I got 2.0 as the result.

PM 77-1
  • 12,933
  • 21
  • 68
  • 111
Olympus
  • 105
  • 1
  • 6

0 Answers0