I'm trying to make an implementation of the Java queue class but I have some problems.
I want the class to implement the following interface:
public interface iQueue<E> {
public void add(E e);
}
public class Queue<E> implements iQueue{
Element<E> first;
@Override
public void add(E e) {
Element<E> node = new Element();
node.setData(e);
}
}
The compiler indicates that the add method parameter must be of type Object to implement the interface
If I declare the parameter of type Object, is the type E declared when constructing the class respected? Thank you very much