package three;
import java.util.ArrayList;
import java.util.List;
public class Cow {
private int age;
public Cow(){
age = 0;
}
public Cow play(){
age ++;
return age > 3 ? new Cow():null;
}
public static void main(String[] args) {
List<Cow> list = new ArrayList<Cow>();
list.add(new Cow());
for(int i = 0; i <= 10;i++){
for(int j =0;j<list.size();j++){
Cow cow = list.get(j).play();
if(cow != null)
list.add(cow);
}
}
System.out.println("10年后,共有:" + list.size());
}
}