public class VarTest
{
public static int staticVar = 0;
public int instanceVar = 0;
public VariantTest()
{
staticVar++;
instanceVar++;
System.out.println(“staticVar=” + staticVar + ”,instanceVar=” + instanceVar);
}
我这样写是不是static修饰的Var永远只分配一个staticVar变量,同时也创建了多个实例化对象? |