NumberFormat Format1() Example
gives Specialization of format.
NumberFormatclass Format1() method example. This example shows you how to use Format1() method.This method gives Specialization of format.
Here is the code:-
/**
* @Program that gives Specialization of format.
* Format1.java
* Author:-RoseIndia Team
* Date:-17-Jun-2008
*/
import java.text.*;
public class Format1 {
public static void main(String[] args) {
//Creating Numberformat instance
NumberFormat nf = NumberFormat.getInstance();
StringBuffer sb=new StringBuffer("Girish");
FieldPosition fp=new FieldPosition(2);
System.out.println("The resulting text is: "+nf.format(1234.56, sb, fp));
}
} |
Output of the program:-
| The resulting text is: Girish1,234.56 |
|