public class GroceryList {
//variables
private int count;
private Item list[];
public final int MAX = 30;
//default
public GroceryList(){
Item placeholder1 = new Item();
Item placeholder2 = new Item();
list[0] = placeholder1;
this.count = 0;
}
}
I want to assign the Object placeholder1 to list[0]
but I get a NullPointerException
.