PetDao petDao = new PetDaoImpl();
List<Pet> pets = petDao.getPets();
for(Pet p : pets){
System.out.println(p.getId() + "\t" + p.getName());
List<Pet> pets = petDao.getPets();
for(Pet p : pets){
System.out.println(p.getId() + "\t" + p.getName());
}
PetStoreDao petStoreDao = new PetStoreDaoImpl();
System.out.println("序号\t商店名称");
for(PetStore ps : petStoreDao.getPetStores()){
System.out.println(ps.getId() + "\t" + ps.getName());
}
//利用新建的对象直接调用方法。中间省去了给list 传pet对象。