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

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -