Menu
Topics Index
...
`

CurrencyDemo - Java Example Program


CurrencyDemo
import java.util.*;

class CurrencyDemo
{
    public static void main(String arg[])
    {
        Currency currency = Currency.getInstance(Locale.US);
        System.out.println( "Currency : " + currency.getDisplayName());
        System.out.println("Symbol : " + currency.getSymbol());    
    }
}
OUTPUT

Currency : US Dollar
Symbol : $

DESCRIPTION

In the above program we are creating a currency object for Locale US and displaying it name and it's symbol.

THINGS TO TRY
  • Create a currency object for Locale CHINA display the currency name and symbol
  • Create a currency object for Locale GERMANY display the currency name and symbol

© meritcampus 2019

All Rights Reserved.

Open In App