内容简介:float是原始数据类型,而不是对象. null检查用于对象.对于基元,您应该使用默认值检查.对于float,默认值为0.0f.翻译自:https://stackoverflow.com/questions/18492432/in-java-how-do-you-check-if-a-float-variable-is-null
看来,当涉及到* value.getFloat(“Value_Quotient”,quotient_Float)== null *时,它遇到了一个问题.我该如何解决?
private void Store() {
quotient_Float = posture_error/time;
if(value.getFloat("Value_Quotient", quotient_Float)==null || quotient_Float < value.getFloat("Value_Quotient", quotient_Float))
{
editor.putFloat("Value_Quotient", quotient_Float);
editor.commit();
}
}
float是原始数据类型,而不是对象. null检查用于对象.对于基元,您应该使用默认值检查.对于float,默认值为0.0f.
翻译自:https://stackoverflow.com/questions/18492432/in-java-how-do-you-check-if-a-float-variable-is-null
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Head First Design Patterns
Elisabeth Freeman、Eric Freeman、Bert Bates、Kathy Sierra、Elisabeth Robson / O'Reilly Media / 2004-11-1 / USD 49.99
You're not alone. At any given moment, somewhere in the world someone struggles with the same software design problems you have. You know you don't want to reinvent the wheel (or worse, a flat tire),......一起来看看 《Head First Design Patterns》 这本书的介绍吧!