John Delmark Aguilar

Delmark - Profiling
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Decimal Places Format

View previous topic View next topic Go down 
AuthorMessage
dElmARk
Admin
Admin
avatar

Posts : 92
Join date : 09/04/2012

PostSubject: Decimal Places Format   Fri Jan 18, 2013 6:27 am

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.
Back to top Go down
View user profile http://delmark.meabout.com
 
Decimal Places Format
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: