getDisplayName(): This method is available in java.util.Currency class of Java.
Syntax:
String java.util.Currency.getDisplayName()
This method gets the name that is suitable for displaying this currency for the default DISPLAY locale.
Note: If there is no suitable display name found for the default locale, the ISO 4217 currency code is returned.
Parameters: NA
Returns: the display name of this currency for the default DISPLAY locale.
Exceptions: NA
Approach
Java
import java.util.Currency;import java.util.Locale;public class CurrencygetDisplayName {public static void main(String[] args) {Currency currency = Currency.getInstance(Locale.US);System.out.println(currency.getDisplayName());}}
Output:
US Dollar
No comments:
Post a Comment