char c1 = 123; //Compiles fine
char c2 = 123456; //Error: cannot convert from int to char
Java is smart enough to determine whether an integer is small enough to be converted to a character. Why is it not able to convert very small floating point literals to a float?. For example:
float f1 = 0.3; //Error: cannot convert from double to float
float f2 = 0.3f; //Compiles fine
char c = some integer literal might compile but float f = some floating point literal will never compile. Why?
PS: I know that a floating point literal is treated as a double by default