I tried to initialize a decimal value as shown below
It gives compiler error "possible loss of precision"Code:
float a = 30.9;
But when I did typecasting as shown below it worked
Seems like it is interpreting 30.9 as double.Code:
float a = (float)30.9;
In C and C++ it is okay to declare float variables as above.
How is this different in Java? Could anyone please help.