java.util.Currency getDisplayName()
Description
Method Syntax
public String getDisplayName()
Method Argument
Data Type | Parameter | Description |
---|---|---|
N/A | N/A | N/A |
Method Returns
The getDisplayName() method of Currency class returns the display name of this currency for the default DISPLAY locale.
Compatibility
Java 1.7
Java Currency getCurrencyCode() Example
Below is a simple java example on the usage of getDisplayName() method of Currency class.
package com.javatutorialhq.java.examples; import static java.lang.System.*; import java.util.Currency; /* * This example source code demonstrates the use of * getDisplayName() method of Currency class. */ public class CurrencyGetDisplayNameExample { public static void main(String[] args) { // create an instance of Currency class Currency currency = Currency.getInstance("NZD"); // prints a more sensible value for currency NZD out.println("NZD is equal to "+currency.getDisplayName()); } }
Basically on the above example, we just created a new Currency object with currency code of NZD. Then we use the getDisplayName() toa value that is more user friendly.