Example usage for java.util Currency getInstance

List of usage examples for java.util Currency getInstance

Introduction

In this page you can find the example usage for java.util Currency getInstance.

Prototype

public static Currency getInstance(Locale locale) 

Source Link

Document

Returns the Currency instance for the country of the given locale.

Usage

From source file:Main.java

public static void main(String[] args) {

    // create a currency with specified currency code
    Currency curr = Currency.getInstance("USD");

    System.out.println(curr.toString());
}

From source file:Main.java

public static void main(String args[]) {
    Locale locale = Locale.UK;
    Currency curr = Currency.getInstance(locale);

    System.out.println(curr.getDisplayName(Locale.UK));
}

From source file:Main.java

public static void main(String args[]) {

    // create a currency object with specified currency code
    Currency curr = Currency.getInstance("USD");

    System.out.println("Currency code :" + curr.getCurrencyCode());
}

From source file:MainClass.java

public static void main(String args[]) {
    Currency c;//w  w w.  j  a va  2s . c  o m

    c = Currency.getInstance(Locale.US);

    System.out.println("Symbol: " + c.getSymbol());
    System.out.println("Default fractional digits: " + c.getDefaultFractionDigits());
}

From source file:Main.java

public static void main(String args[]) {

    // create a currency for uk locale
    Locale locale = Locale.UK;
    Currency curr = Currency.getInstance(locale);

    // get and print the symbol of the currency
    System.out.println("Currency symbol is = " + curr.getSymbol(locale));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setCurrency(Currency.getInstance(Locale.GERMANY));
    System.out.println(format.clone());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setCurrency(Currency.getInstance(Locale.GERMANY));
    System.out.println(format.getCurrency());

}

From source file:Main.java

public static void main(String args[]) {

    // create a currency object with specified locale
    Locale locale = Locale.GERMANY;
    Currency curr = Currency.getInstance(locale);

    System.out.println("Locale's currency code:" + curr.getCurrencyCode());

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DecimalFormat format = new DecimalFormat();
    format.setCurrency(Currency.getInstance(Locale.GERMANY));

    DecimalFormat format1 = new DecimalFormat();

    System.out.println(format1.equals(format));
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    NumberFormat numberFormat = NumberFormat.getNumberInstance();
    numberFormat.setCurrency(Currency.getInstance(Locale.CANADA));
}