Is an ArrayList automaticaly declared static ,if it is an instance variable?(Java)
Posted
by Alex
on Stack Overflow
See other posts from Stack Overflow
or by Alex
Published on 2010-05-09T07:44:28Z
Indexed on
2010/05/09
7:48 UTC
Read the original article
Hit count: 232
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?
© Stack Overflow or respective owner