This content has been marked as final. Show 3 replies
Ottobonn wrote:Every object will have its own variable, but not necessarily the same array. In fact it's quite conceivable (and likely) that all the variables refer to the same array object. To the OP: Do you provide each variable with a copy of the original array?
If you don't call it static, every object will have its own array. Unless, of course, you are constructing them all by passing them the same array.
every object will have its own array. Unless, of course, you are constructing them all by passing them the same array.Each instance will get its own reference to an array. But, as Ottobonn says, it's up to you to make sure the references refer to different arrays. Check that for each instance "new int" is being used somewhere - most likely in the constructor or, if your property has a setter method, by whoever calls that setter.