Using Vector, data get duplicated
Hey,
I really need help
while using Vector and adding elements, I get this problem:
I add the 1st element: OK
I add the 2nd element: 2 elements in the vector, but the first element gets the value of the second element
I add the 3rd element: the vector contains 3 elements, all have the value of the 3rd element
..and so on
here is the source code (written only the essential not to make it complicated for you)
public static void main(String[] args) throws IOException, InterruptedException {
int[] x1,x2,x3;
Vector<int[]> population= new Vector<int[]>(50);
// initialize x1,x2,x3 from some function
population.addElement(x1);
population.addElement(x2);
population.addElement(x3);
}
Thank you
Re: Using Vector, data get duplicated