In Java, floating-point literals like 12.3 are treated as double by default (64-bit). To assign them to a float variable (32-bit), you must either use the 'f' suffix (12.3f) or cast the value. Without this, the compiler will flag an error due to potential loss of precision from double to float.