关于就JAVA中成员变量的访问

public class Demo {
public int i;
public static int j;

public void test() {
i = 0;
j = 1;
}
}

public class testDemo {
public static void main(String[] args) {
Demo demo = new Demo();
demo.test();
System.err.println(demo.i);
System.err.println(Demo.j);
}
}

i 必须要用对象调用;

j由于是静态的可直接类名调用

posted @ 2017-09-29 19:34  Azjs丶V1  阅读(310)  评论(0)    收藏  举报