程序如下
import java.text.*;
class FormatTest 
{
public static void main(String[] args) 
{
  double x=10000.0/3.0;
  System.out.println(x);
  NumberFormat nf=NumberFormat.getNumberInstance(Locale.GERMAN);
System.out.println(nf.format(x));
}
}
編譯錯誤如下
---------- Java編譯 ----------
FormatTest.java:8: cannot resolve symbol
symbol  : variable Locale  
location: class FormatTest
NumberFormat nf=NumberFormat.getNumberInstance(Locale.GERMAN);
                                                               ^
1 error
Output completed (0 sec consumed) - Normal Termination