好像在*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
是一种原始
数据类型,而不是对象
。空检查用于对象。对于基元,您应该使用默认值检查。对于 float ,默认值为 0.0f。
关于java - 在 Java 中,如何检查 float 变量是否为 null?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18492432/