eclipse - displaying Java double value -


here's piece of java code:

 import java.util.*;  public class javatests {     public static void main(string[] args)     {         double decimal = 0.60;          system.out.println(decimal);     } } 

i'm trying print 0.60, compiler prints 0.6. how can print 0.60? thanks!

numberformat formatter = new decimalformat("#0.00"); double decimal = 0.60; system.out.println(formatter.format(decimal)); 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -