MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;

public class MainClass {

    public static void main(String[] argv) {
        NumberFormat nf = NumberFormat.getInstance();
        if (nf instanceof DecimalFormat) {
            DecimalFormat df = (DecimalFormat) nf;

            DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();

            dfs.setCurrencySymbol("AD$");

            df.setDecimalFormatSymbols(dfs);

            df.applyPattern("\u00a4#,###.##");
        }

        System.out.println(nf.format(1234.56));

    }
}