Answer:

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.

Floating Point Output

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

Notice that the output value has been rounded and shows three places to the right of the decimal.

QUESTION 5:

Has the contents of the variable value been changed by format()?