Example4_11(关键字this)

public class Tom{
 int leg;
 Tom(int n){
  this.cry();
  leg=n;
  this.cry();
 }
 void cry(){
   System.out.println("我是Tom,我现在有"+leg+"条腿");
  }
 public static void main(String args[]){
  Tom cat=new Tom(4);
 }
}

原文地址:https://www.cnblogs.com/wangchunmeix/p/2977695.html