Can't access two vectors independantly?
Hi I haven't used Vectors before but I can't work out what I'm doing wrong here. I have a class called PointSequence which contains a Vector of Points (and some methods to work with them). If I then create two instances of this class (or an array of two for that matter), adding something to one of them seems to add it to both.
This produces the following output:
// A class for a sequence of Points
public class PointSequence
static Vector <Point> points=new Vector <Point> (); //the x,y locations are stored in a vector which will grow as you add items
//i have some other methods here
public static void main(String args)
//create two instances of the new class
PointSequence testA=new PointSequence();
PointSequence testB=new PointSequence();
//add something to A
//add something different to B
//print out the contents of each instance
Why do both have the same contents even though I added one item to each?!! Is there something fundamental I am misunderstanding about Vectors or classes?