Mega Code Archive

 
Categories / Java Tutorial / Development
 

Using the ( flag to place parentheses around negative numbers

public class MainClass  {    public static void main( String args[] )     {       System.out.printf( "%(d\n", 50 );       System.out.printf( "%(d\n", -50 );       System.out.printf( "%(.1e\n", -50.0 );    } } 50 (50) (5.0e+01)