Is an ArrayList automaticaly declared static ,if it is an instance variable?(Java)
- by Alex
Hy ,what i`m trying to do is something like this:
private class aClass
{
private ArrayList idProd;
aClass(ArrayList prd)
{
this.idProd=new ArrayList(prd);
}
public ArrayList getIdProd()
{
return this.idProd;
}
}
So if i have multiple instances of ArrayLIst (st1 ,st2 ,st3) and I want to make new objects of aClass :
{
aClass obj1,obj2,obj3;
obj1=new aClass(st1);
obj2=new aClass(st2);
obj3=new aClass(st3);
}why all of the aClass objects will return st3 if I access the method getIdProd() for each of them(obj1..obj3)? is an arraylist as a instance variable automatically declared static?