I'm trying to add different types of variables (String and Integer) to a object list, but when I'm running the code I always get a NullPointerException. I already debugged it and the variables aren't null. Can someone help me and tell me how I can add different types of variables to an object list?
private int x;
private int y;
private int z;
private int stockwerk;
private String address;
private List<Object> list;
public List<Object> getAttributeList () {
list.add(1, this.x);
list.add(2, this.y);
list.add(3, this.z);
list.add(4, this.stockwerk);
list.add(5, this.address);
return this.list;
}