A
Andreas Leitgeb
Integer literals are per default of type "int", fine.
Floating point literals are per default type "double", fine.
For initializers, integer arguments are automatically cast down:
byte b=42;
Why not for floats?
float f=4.2; --> error: possible loss of precision.
Of course I know, that I can add an "f", to solve this, but why?
Why doesn't javac follow the same reasons as for the integral case?
Floating point literals are per default type "double", fine.
For initializers, integer arguments are automatically cast down:
byte b=42;
Why not for floats?
float f=4.2; --> error: possible loss of precision.
Of course I know, that I can add an "f", to solve this, but why?
Why doesn't javac follow the same reasons as for the integral case?