我已经获得了以下主要方法,并且必须为 ObjectList 类编写代码。我应该推断 ObjectList 类的必要功能并自己编写该类,但是我不确定我需要做什么才能实现此功能。非常感谢任何帮助理解这一点。这是给我的代码:
ObjectList ol = new ObjectList(3);
String s = "Im Happy";
Dog d = new Dog();
DVD v = new DVD();
Integer i = 1234;
System.out.println(ol.add(s));
System.out.println(ol.add(d));
System.out.println(ol.add(v));
System.out.println(ol.add(i));
ol.remove(0);
System.out.println(ol.add(i));
System.out.println("Is the list full? "+ isFull());
System.out.println("Is the list empty? "+ isEmpty());
System.out.println("Total number of objects in the list: " + getTotal());
Object g = ol.getObject(1);
g.bark();
jeck猫
函数式编程
相关分类