When I use the code:
import java.util.*;
class BagTest<E> extends LinkedList<E> {
/** Add object to bag
* @param ob the object to add
*/
public void add(E ob) {
super.addLast(ob);
}
}
I get the error:
BagTest.java:8: add(E) in BagTest cannot implement add(E) in java.util.Collection; attempting to use incompatible return type
Now I know that add in Collection is boolean, but I'm either overriding or creating a new method ???