public class Application {
public static void main(String[] args) {
final class Constants {
public static String name = "globe";
}
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
System.out.println(Constants.name);
}
});
thread.start();
}
}
编译错误:
在非静态内部类型中声明名称不能是静态的,除非使用常量表达式进行初始化
解决方法?