Again, that depends on where you are. Some possible choices are
12,345.6789 12.345,6789 12 345,6789
Some countries use a decimal point to separate the integer part of a number from the fractional part, others use a comma.
The default locale determines how DecimalFormat.format()
formats a floating point number.
Here is a program that shows this.
import java.text.*;
class IODemoFloat
{
public static void main ( String[] args )
{
double value = 12345.6789 ;
DecimalFormat numform = new DecimalFormat();
System.out.println( "value = " + numform.format(value) );
}
}
The output (on my computer) is:
value = 12,345.679
The output value has been rounded to three places to the right of the decimal point.
Has the variable value been changed
by format()?