Reputation: 2219
This might be kind of a dumb question, but I'm stuck on it.
I'm trying to set the RoundingMode
on a DecimalFormat
.
DecimalFormat df = new DecimalFormat("###.##");
df.setRoundingMode(RoundingMode.HALF_UP);
However, the code looks fine to me and it looks the same as many examples I have seen.
The error on setRoundingMode()
is:
***The method setRoundingMode(RoundingMode) is undefined for the type DecimalFormat***
It suggests to cast df
to an Object
, but that doesn't solve anything...
Any suggestions?
EDIT
I am using ver. 1.7
Below I changed the compliance level to 1.6 yet no difference.
Thank you in advance for the help!
Upvotes: 1
Views: 405
Reputation: 1168
Try System.out.println(System.getProperty("java.version"));
and be sure that your jre version really is 1.6 or higher
Upvotes: 1