Why Java double print format differs depending on using String.format or not

Posted by michael lucas on Stack Overflow See other posts from Stack Overflow or by michael lucas
Published on 2010-04-13T07:35:28Z Indexed on 2010/04/13 7:42 UTC
Read the original article Hit count: 400

Filed under:
|
|
|

This code:

 System.out.println(String.format("%f", Math.PI));
 System.out.println(Math.PI);

produces that result on my computer:

3,141593
3.141592653589793

Why does the first line print float number with comma while the second one uses dot?

© Stack Overflow or respective owner

Related posts about java

Related posts about locale