- #1
friendbobbiny
- 49
- 2
I've imported java.util, java.text and placed the following method under an appropriate class.
I'm unable to pinpoint why compiler can't instantiate the type NumberFormat in my method's second line
public static void tailorFormat(String name, double value, Locale loc){
NumberFormat kitty = new NumberFormat (loc); // <<<<< this is where I've referred to
DecimalFormat shelter = (DecimalFormat) kitty;
shelter.applyPattern(name);
shelter.format(value);
System.out.println(name + " " + value + " " + loc.toString());
}
I'm unable to pinpoint why compiler can't instantiate the type NumberFormat in my method's second line
public static void tailorFormat(String name, double value, Locale loc){
NumberFormat kitty = new NumberFormat (loc); // <<<<< this is where I've referred to
DecimalFormat shelter = (DecimalFormat) kitty;
shelter.applyPattern(name);
shelter.format(value);
System.out.println(name + " " + value + " " + loc.toString());
}