第一次发帖,求管理员给些技术分啊。求下面代码的输出结果
- package cn.cast;
- public class Exercises6_2 {
- private static int count;//10
- private String name;
- public class Student {
- private int count;
- private String name;
- public void Output(int count) {
- count++;
- this.count++;
- Exercises6_2.count++;
- Exercises6_2.this.count++;
- System.out.println(count + " " + this.count + " "
- + Exercises6_2.count + " " + Exercises6_2.this.count++);
- }
- }
- public Student aStu() {
- return new Student();
- }
- public static void main(String args[]) {
- Exercises6_2 g3 = new Exercises6_2();
- g3.count = 10;
- Exercises6_2.Student s1 = g3.aStu();
- s1.Output(5);
- }
- }
复制代码 Exercises6_2.count++;
Exercises6_2.this.count++;
上面这两个是一样的吗?this代表哪个对象?
|
|