class Dog(){ eat(); } ArrayList<Object> myArrayList = new ArrayList<Object>(); Dog aDog = new Dog(); myArrayList.add(aDog); object d = myArrayList.get(0); (Dog)d.eat();
时间: 2024-10-12 21:54:45
class Dog(){ eat(); } ArrayList<Object> myArrayList = new ArrayList<Object>(); Dog aDog = new Dog(); myArrayList.add(aDog); object d = myArrayList.get(0); (Dog)d.eat();