Originally posted by ty lee:
Dear helper:
double d=12.5
float f=12.5
is syntax f=12.5 correct?
what is different between f=12.5 and d=12.5?
the floating point constants(Literals) in
java are treated as doubles
so float f = 12.5 will give compile time error
u need to declare and intialise it as
float f=12.5f;
to specificaly tell compiler u want f to be intialised as a float.
hope this helps