I have a problem with this part of the code. It seems that if I try to add something to a list of Client
I get a NullPointerException
. I really don't know why because if I debug this part of the code the variable of type Client
has information. If someone can help me I would be grateful. Here is the part of the code where the exception appears:
public class Customers {
private ArrayList<Client> listaClienti;
public Customers()
{
}
public void addClient(Client c,int i)
{
listaClienti.add(i, c);
}
public void deleteClient(Client c)
{
listaClienti.remove(c);
}
public Client getClient(int id)
{
return listaClienti.get(id);
}
}