This is my first time dealing with inheritance and I'm trying to create a subclass of the ArrayList class, but I'm getting stopped pretty early on.
import java.util.ArrayList;
/**
* extending to ArrayList
*/
public class SortedArrayList<E> extends ArrayList<E>
{
/**
* Inheriting the supers constructors
*/
public SortedArrayList()
{
super();
}
public void add(){
SortedArrayList.add(); // testing out inherited method.
}
}
however when I try to compile this I get an error, "non-static method add() can not be referenced from a static context"
What am I doing wrong?