/*
Factory Method Example using java API
author: itsafiz@gmail.com
*/
import java.util.*;
import java.text.*;
class FactoryMethodExample // main class
{
public static void main(String[]args)
{
NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance();
NumberFormat percentFormatter = NumberFormat.getPercentInstance();
double a = 20.5;
System.out.println(currencyFormatter.format(a));
System.out.println(percentFormatter.format(a));
}
}
0 Comments