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);
 }
}

posted on 2013-03-22 21:54  张思宇  阅读(111)  评论(0)    收藏  举报