内部类访问静态变量,有些地方搞不懂啊,求帮助!
package com.lin;//外部类
public class GroupThree {
private static int count;
private String name;
//内部类
public class Student{
private int count;
private String name;
public void Output(int count){
count++; //6
this.count++; //1
GroupThree.count++; //12
GroupThree.this.count++;//12
System.out.println(count+" "+this.count+" "+
GroupThree.count+" "+GroupThree.this.count);
}
}
public static void main(String[] args) {
GroupThree g=new GroupThree();
g.count=10;
//用外部类创建内部类的格式
GroupThree.Student s=new GroupThree().new Student();
s.Output(5);
}
}
运行结果是:6 1 12 12 。
问题:怎么GroupThree.count++;执行的结果是12,不是11吗?真搞不懂啊。
GroupThree.this.count++;//12 这个和上面的语句如何理解啊?求大侠帮帮忙,小弟不才啊!!