What benefits has the following?
private double pro;
pro = Double.NaN;
Why not make it
pro = 0.0;
the getter is:
public double getpro() {
if (Double.isNaN(pro))
somemethod();
return pro;
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Because
NanNstands for “not a number,” it is generally a hint that the number hasn’t been initialized.You could use
pro = 0.0;and that would be fine, too. I think that the issue is more of a style-thing.