package mymy.this关键字;
public class Test {
public static void main(String[] args) {
Test.method1();
method1();
Test t=new Test();
t.method2();
}
public static void method1(){
Test.doSome();
doSome();
Test t=new Test();
t.doOther();
System.out.println(t.i);
}
public void method2(){
Test.doSome();
doSome();
Test s=new Test();
s.doOther();
this.doOther();
System.out.println(this.i);
System.out.println(i);
}
int i=10;
public static void doSome(){
System.out.println("do some!");
}
public void doOther(){
System.out.println("do other!");
}
}
do some!
do some!
do other!
10
do some!
do some!
do other!
10
do some!
do some!
do other!
do other!
10
10