public class Tom2{
int leg;
Tom2(int n){
this.cry();
leg=n;
this.cry();
}
void cry(){
System.out.println("我是Tom,我现在有"+leg+"条腿");
}
public static void main(String args[]){
Tom2 cat=new Tom2(4);
}
}
public class Tom2{
int leg;
Tom2(int n){
this.cry();
leg=n;
this.cry();
}
void cry(){
System.out.println("我是Tom,我现在有"+leg+"条腿");
}
public static void main(String args[]){
Tom2 cat=new Tom2(4);
}
}
转载于:https://www.cnblogs.com/xuhui123/archive/2013/03/23/2976889.html