Created
August 16, 2016 17:42
-
-
Save stuart-marks/da122da352e6091fa088d1a35cff4db0 to your computer and use it in GitHub Desktop.
Decimal Separator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat Printf.java | |
public class Printf { | |
public static void main(String[] args) { | |
System.out.println("Locale.getDefault()=" + java.util.Locale.getDefault()); | |
System.out.printf("%.3f%n", 123.45); | |
} | |
} | |
$ javac Printf.java | |
$ java -version | |
java version "1.8.0_77" | |
Java(TM) SE Runtime Environment (build 1.8.0_77-b03) | |
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode) | |
$ java Printf | |
Locale.getDefault()=en_US | |
123.450 | |
$ java -Duser.country=DE -Duser.language=de Printf | |
Locale.getDefault()=de_DE | |
123,450 | |
[switch JDK versions] | |
$ java -version | |
java version "9-ea" | |
Java(TM) SE Runtime Environment (build 9-ea+127) | |
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+127, mixed mode) | |
$ java Printf | |
Locale.getDefault()=en_US | |
123.450 | |
$ java -Duser.country=DE -Duser.language=de Printf | |
Locale.getDefault()=de_DE | |
123,450 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment