Answer:

Yes

Applet with #'s

Here is the fragment, now using #

double A= 0.1, B= -0.1;

DecimalFormat numform = new DecimalFormat(" ##0.###;-##0.###"); 

System.out.println( "A = " + numform.format(A) );  
System.out.println( "B = " + numform.format(B) );  

The fragment now writes:

A =  0.1
B = -0.1

Here is the applet. Play for a while.

Format patterns that contain # create strings of varying lengths, so it is hard to align numbers in columns of output.

QUESTION 16:

What does the following fragment write?

double A= 123.1, B= -1.1;

DecimalFormat numform = new DecimalFormat(" ##0.###;-##0.###"); 

System.out.println( "A = " + numform.format(A) ); 
System.out.println( "B = " + numform.format(B) );