PDA

Click to See Complete Forum and Search --> : [RESOLVED] Declare a const float


JuggaloBrotha
Jan 27th, 2010, 02:08 PM
We're using NetBeans in my Java class and I'm wondering why this wont compile:public class LoanClass {
const float HOUSE_15YR = 1.2;
const float HOUSE_30YR = 1.2;

}NetBeans is telling me that there's a loss of data and that I should change the 'float' to a 'double' and when I do that it still wont compile because it's an illegal start of type. What does that mean?

All I need is a float that's a constant.

David Anton
Jan 27th, 2010, 03:48 PM
Use 'static final' instead of 'const'.
('const' is a keyword in Java, but it's currently unused).

JuggaloBrotha
Jan 28th, 2010, 05:50 AM
Thanks, I did eventually find a page via google that said that.