请教各位一个问题?
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++;
this.count++;
GroupThree.count++; //有疑问的语句
GroupThree.this.count++;//有疑问的语句
System.out.println(count+" "+this.count+" "+GroupThree.count+" "+GroupThree.this.count++);有疑问的语句
}
}
public Student aStu(){
return new Student();
}
public static void main(String[]args){
GroupThree g3=new GroupThree();
g3.count=10;
GroupThree.Student s1=g3.aStu();
s1.Output(5);
}
}
输出结果是:6 1 12 12
问题一:
为什么GroupThree.count;和GroupThree.this.count++;无论注释哪一句,GroupThree.count和GroupThree.this.count++的结果都一样.
问题二:将GroupThree.this.count++的++去掉,输出的结果和去掉之前一样.
[此贴子已经被作者于2007-11-7 21:49:03编辑过]