I cannot seem to find why I am getting this error message. I thought I have already instantiated my array in my main.
Exception in thread "main" java.lang.NullPointerException
public class A1ArrayList<E> {
private E[] e;
private int capacity = 0;
public A1ArrayList(){
}
public int size(){
return e.length;
}
public boolean add(E addElement){
e[capacity] = addElement;
capacity = capacity + 1;
return true;
}
public static void main(String[] arg){
A1ArrayList<Object> e = new A1ArrayList<Object>();
e.size();
}