相关疑难解决方法(0)

为什么两个整数的除法在Java中返回0.0?

int totalOptCount = 500;
int totalRespCount=1500; 
float percentage =(float)(totalOptCount/totalRespCount);
Run Code Online (Sandbox Code Playgroud)

为什么这总是返回值0.0?另外我想将其格式化为00.00格式并转换为字符串?

java floating-point integer-division

49
推荐指数
3
解决办法
6万
查看次数

标签 统计

floating-point ×1

integer-division ×1

java ×1