public class ClassDemo {
static int a;
static int b;
private static final ClassDemo INSTANCE = new ClassDemo(a,b);
private ClassDemo(int x,int y){}
public static ClassDemo getInstance()
{
return INSTANCE;
}
public static void main(String[] args)
{
ClassDemo.a =4;
ClassDemo.b =5;
ClassDemo s1 = ClassDemo.getInstance();
System.out.print(s1.a+" ");
ClassDemo.a =6;
ClassDemo.b =7;
ClassDemo s2 = ClassDemo.getInstance();
System.out.print(s1 == s2);
System.out.print(s1.a+" "+s2.a);
}
}请问用final修饰的变量怎么还能赋值呢
|