package Computerpractice;
import java.util.List;
import java.util.ArrayList;
public class DogTest {
public static void main(String[] args) {
Dog ou=new Dog("欧欧","雪娜瑞");
Dog yy=new Dog("亚亚","拉布拉多");
Dog ff=new Dog("菲菲","拉布拉多");
Dog mm=new Dog("美美","雪娜瑞");
List Doglist=new ArrayList();
Doglist.add(ou);
Doglist.add(yy);
Doglist.add(ff);
Doglist.add(mm);
System.out.println("狗狗的总数为:"+Doglist.size()+"只");
for (int i = 0; i <Doglist.size(); i++) {
Dog dog=(Dog)Doglist.get(i);
System.out.println((i+1)+":"+dog.getDogName()+"\t"+dog.getDogType());
}
}
}
import java.util.List;
import java.util.ArrayList;
public class DogTest {
public static void main(String[] args) {
Dog ou=new Dog("欧欧","雪娜瑞");
Dog yy=new Dog("亚亚","拉布拉多");
Dog ff=new Dog("菲菲","拉布拉多");
Dog mm=new Dog("美美","雪娜瑞");
List Doglist=new ArrayList();
Doglist.add(ou);
Doglist.add(yy);
Doglist.add(ff);
Doglist.add(mm);
System.out.println("狗狗的总数为:"+Doglist.size()+"只");
for (int i = 0; i <Doglist.size(); i++) {
Dog dog=(Dog)Doglist.get(i);
System.out.println((i+1)+":"+dog.getDogName()+"\t"+dog.getDogType());
}
}
}