Menu
Question Index
...

What will be output of the following program?

import java.util.Locale;

public class DifferentCurrency {
    public static void main(String[] args) {
        printCurrency(Locale.US);
    }
    public static void printCurrency(Locale locale) {
        Currency c;
        c = Currency.getInstance(locale);
        System.out.println("Currency code and Symbole is -> " + c.getCurrencyCode() + " ~ " + c.getSymbol());
        System.out.println("Display name is -> " + c.getDisplayName());
    }
}


Currency code and Symbole is -> USA ~ $
Display name is -> US Dollar
Currency code and Symbole is -> USD ~ $
Display name is -> US Dollar
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java Currency Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App