将双精度转换为浮点数
答
1.33
是double
文字,并且它导致整个hours + (hrsStr * 1.33) * rate
表达式返回一个double
值,这是不能被分配给一个float
变量无明确的演员。
将其更改为1.33f
为float
文字。
+0
非常感谢! – Kiotzu
可能的重复http://stackoverflow.com/questions/16369726/declaring-floats-why-default-type-double – Keale
相关:http://stackoverflow.com/questions/3033137/representing-float-values- in-java http://stackoverflow.com/questions/14102955/java-why-do-you-need-to-specify-af-in-a-float-literal – Keale
http://stackoverflow.com/questions的副本/ 16369726/declaring-floats-why-default-type-double – T8Z