John Delmark Aguilar
Would you like to react to this message? Create an account in a few clicks or log in to continue.
John Delmark Aguilar

Personal Forum
 
HomeSearchLatest imagesRegisterLog in

 

 Decimal Places Format

Go down 
AuthorMessage
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

Decimal Places Format Empty
PostSubject: Decimal Places Format   Decimal Places Format Icon_minitimeFri 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.
Back to top Go down
https://delmark.forumtl.com
 
Decimal Places Format
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: