相关疑难解决方法(0)

如何测试double是否为整数

是否有可能做到这一点?

double variable;
variable = 5;
/* the below should return true, since 5 is an int. 
if variable were to equal 5.7, then it would return false. */
if(variable == int) {
    //do stuff
}
Run Code Online (Sandbox Code Playgroud)

我知道代码可能不会去这样的事情,但怎么去了?

java math

146
推荐指数
7
解决办法
11万
查看次数

标签 统计

java ×1

math ×1