public class text{
 // 没有statc的变量i
 int i=19;
 // 带有static的变量abstract 
 static int a=10;
 // 带有static的方法doSome
 public static void doSome(){
  System.out.println("do some!");
 }
 public void doOther(){
  System.out.println("do other!");
 }
 public void method1(){
  // 调用doSome
  // 完全方式调用
  text.doSome();
  // 省略方式调用
  doSome();
  // 调用doOther
  // 完全方式调用
  this.doOther();
  // 省略方式调用
  doOther();
  // 访问i
  // 完全方式访问
  System.out.println(this.i);
  // 省略方式访问
  System.out.println(i);
  // 访问a
  // 完全方式访问
  System.out.println(text.a);
  // 省略方式访问
  System.out.println(a);
 }
 public static void method2(){
     // 调用doSome
  // 完全方式调用
  text.doSome();
  // 省略方式调用
  doSome();
  // 调用doOther
  // 完全方式调用
  text t=new text();
  t.doOther();
  // 省略方式调用
  // 访问i
  // 完全方式访问
  // 省略方式访问
  System.out.println(t.i);
  // 访问a
  // 完全方式访问
  System.out.println(text.a);
  // 省略方式访问
  System.out.println(a);
 }
 public static void main (String[] args){
  // 调用method1
  // 完全方式调用
  text v=new text();
  v.method1();
  // 省略方式调用
  // 调用method2
  // 完全方式调用
  text.method2();
  // 省略方式调用
  method2();
 }
}
this/static
原文:https://www.cnblogs.com/wangmoumou/p/13782354.html