Discuss / Java / 格式化输出还需要格式转换吗?

格式化输出还需要格式转换吗?

Topic source
%.2f不就是格式化浮点数的意思吗,还需要加上(float)去计算结果吗

心云意水

#2 Created at ... [Delete] [Delete and Lock User]

int计算结果也是int,不转化为float,不可能输出两位小数的正确值。


  • 1

Reply