在这种情况下如何计算字符串值?

时间:2018-07-18 20:35:48

标签: java string types integer

这里有两个String值用于计算。最后我需要一个双精度值

int weight_int = Integer.valueOf("65");
int height_int = Integer.valueOf("185");
double imt =((weight_int/(height_int*height_int))*10000);

1 个答案:

答案 0 :(得分:0)

如果您需要一个Double,则无法通过将两个Integer相除来获得它。您需要将其中之一转换为Double。

相关问题