Developer's Daily | Java Education - Test Projects |
front page | java | perl | unix | DevDirectory |
import java.text.*; public class NumberFormatTests { public static void main (String[] args) { double amount = 100.0; NumberFormat nf = new DecimalFormat("#,###.00"); for ( double d=0; d<200; d+=50.5 ) { amount = amount + d; System.out.println( "" ); System.out.println( "amount without formatting: " + amount ); System.out.println( "amount with formatting: " + nf.format(amount) ); } } } |
|
Copyright © 1998-2003 DevDaily
Interactive, Inc. All Rights Reserved. |