NumberFormat GetPercentInstance() Example
Returns a percentage format for the current default locale.
NumberFormatclass GetPercentInstance() method example. This example shows you how to use GetPercentInstance() method.This method Returns a percentage format for the current default locale.
Here is the code:-
/**
* @Program that Returns a percentage format for the current default locale.
* GetPercentInstance.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
import java.util.*;
public class GetPercentInstance {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getPercentInstance();
System.out.println("Percentage format for the current default locale: "
+nf.getCurrency());
}
} |
Output of the program:-
| Percentage format for the current default locale: INR |
|