求教Java高手
刚学用Java,我有下面的一段程序,如果s的值(value)是空字符串,或者不是数字字符串,我这样查d有没有问题?
string s = ''; --s 是个变量
Double d = Double.valueOf(s);
if(d!=null & d>0.001){...
}
my question is: if s is string.empty or not a number, is d null? or when i do Double.valueOf(s), already get exception? two lazy, i should create a unit test for this.
谢谢。
string s = ''; --s 是个变量
Double d = Double.valueOf(s);
if(d!=null & d>0.001){...
}
my question is: if s is string.empty or not a number, is d null? or when i do Double.valueOf(s), already get exception? two lazy, i should create a unit test for this.
谢谢。

