当前页面: 开发资料首页 → J2SE 专题 → NumberFormatText.java:8: 找不到符号
NumberFormatText.java:8: 找不到符号
摘要: NumberFormatText.java:8: 找不到符号
import java.text.*;
public class NumberFormatText
{
public static void main(String[] args)
{
double d=562354.78;
NumberFormat n=NumberFormat.getCurrencyInstance(Locale.GERMANY);
System.out.println(n.format(d));
}
};
能帮我看看么?我是在看了《core java》第六版的第三章后写的,在没有“Locale.GERMANY”时能正常运行来着
报什么错?
NumberFormatText.java:8: 找不到符号
符号: 变量 Locale
位置: 类 NumberFormatText
NumberFormat n=NumberFormat.getCurrencyInstance(Locale.GERMANY);
^
1 错误
import java.text.*;
如果你的import只有这一行的话
你还要导入NumberFormat这个类
NumberFormat类就是属于java.text包的啊
Locale.GERMANY
难道这个才是得继续引用另一个类?
哦,应该是导入Locale类吧,说错了,报错是找不到Locale
java.util.Locale
好了,谢谢,就是可惜本来应该出现在后的GM货币符号换成了个问号