Java Currency Class: toString() Method
public String toString()
The toString() method is used to get the ISO 4217 currency code of a given currency.
Package: java.util
Java Platform: Java SE 8
Syntax:
toString()Return Value:
the ISO 4217 currency code of this currency
Return Value Type: String
Example: Java Currency class: toString() Method
The following example fills aJava Currency class: toString() Method
import java.util.*;
public class Main {
public static void main(String args[]) {
// Create a currency with specific currency code
Currency curr = Currency.getInstance("YER");
// Get the currency string and display it
System.out.println("String representation: " + curr.toString());
}
}
Output:
String representation: YER
Java Code Editor:
Previous:getSymbol Method
Next:Java String Methods
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework