【问题标题】:How to calculate String values in this case?在这种情况下如何计算字符串值?
【发布时间】:2018-12-26 21:06:21
【问题描述】:

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

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

【问题讨论】:

  • 有什么问题?整数除法? (这是一个提示。)
  • 您的问题措辞不当,因此被否决。

标签: java string types integer


【解决方案1】:

如果你需要一个 Double,你不能通过将两个整数相除来得到它。您需要将其中一个转换为 Double。

【讨论】:

    猜你喜欢
    • 2019-06-13
    • 1970-01-01
    • 1970-01-01
    • 2019-10-31
    • 1970-01-01
    • 2016-11-18
    • 1970-01-01
    • 1970-01-01
    • 2014-09-09
    相关资源
    最近更新 更多