1. public static void main(String[] args)
2. {
3. Character s=1;
4. Float f=1;
5. }
Both the lines 3 and 4 have a wrapper class and compiler performs autoboxing to convert 1 to Character but compiler cannot convert the same 1 to Float. Why?
Float numbers you need to append 'f' or 'F' at end of the number like this Float f=1f; or Float f=1F;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With