Menu
Question Index
...

What will be output of the following program?

import java.util.*;

public class DifferentCurrency {
    public static void main(String[] args) {
        printCurrency(Locale.US);
        printCurrency(Locale.TAIWAN);
        printCurrency(Locale.ITALY);
    }
    public static void printCurrency(Locale locale) {
        Currency c;
        c = Currency.getInstance(locale);
        System.out.println(c.getCurrencyCode());
    }
}


USD
TWD
EUR
US
TAIWAN
ITALY
Some other output
Compilation Error or 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