Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.text.NumberFormat;
import java.util.Locale;

public class Main {

    public static void main(String[] argv) {
        NumberFormat numberFormat = NumberFormat.getInstance();
        numberFormat.setParseIntegerOnly(false);
        double usersNumber = 197912.29;

        numberFormat = NumberFormat.getNumberInstance(Locale.US);
        System.out.println("User's number (US): " + numberFormat.format(usersNumber));
        numberFormat = NumberFormat.getNumberInstance(Locale.GERMANY);
        System.out.println("User's number (GERMANY): " + numberFormat.format(usersNumber));
        numberFormat = NumberFormat.getNumberInstance();
        System.out.println("User's number (DEFAULT LOCALE): " + numberFormat.format(usersNumber));
    }
}