dElmARk Admin
Posts : 92 Join date : 09/04/2012
| Subject: Decimal Places Format Fri Jan 18, 2013 1:27 pm | |
| - Code:
-
import java.text.*; public class DecimalPlaces { public static void main(String[] args) { double d = 1.234567; DecimalFormat df = new DecimalFormat("#.##"); System.out.print(df.format(d)); System.out.printf ("%.2f", d); } }
Import tha java.text.*; if you will use Decimal Format. | |
|