Decimal Formatting
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   saba_sundke
Posted On:   Monday, March 19, 2001 05:18 AM

Im trying to format a decimal to allow only 2 places after the decimal. It doent not work !!! HELP!!!

import java.text.*;
class temp
{
public static void main(String s[])
{

DecimalFormat df = new DecimalFormat();
try{
df.applyPattern("0.00");
df.setMaximumFractionDigits(2);

System.out.println(df.parse("7.7777"));
}
catch (Exception e)
{
System.out.println(e);
}
}

}

Re: Decimal Formatting

Posted By:   Anonymous  
Posted On:   Wednesday, May 30, 2001 02:11 PM

Use df.format() instead of parse.
About | Sitemap | Contact