i) in your driver class create a new Vector, and use it to store the two instances of the Politican calss you created in quesation 1
the two instances are called politician1 and politician2
i tried using myVector.add(politician1); but it errored and so did myVector.addElement(blah);
( ,
Tue 20 Apr 2004, 1:32,
archived)
the two instances are called politician1 and politician2
i tried using myVector.add(politician1); but it errored and so did myVector.addElement(blah);
have you called new on the vector?
Vector v;
v = new Vector();
v.addElement(politician1);
( ,
Tue 20 Apr 2004, 1:37,
archived)
Vector v;
v = new Vector();
v.addElement(politician1);
yeah
Vector myVector = new Vector();
myVector.addElement(politician1);
( ,
Tue 20 Apr 2004, 1:39,
archived)
myVector.addElement(politician1);
sommit like dis?
Vector myVector = new Vector();
myVector.add(politican1);
myVector.add(politican2);
inside the Vector, they are stored as nameless Objects to get them back, u need to use casting, and assign to new
variables
Politican pol1, pol2;
pol1 = (Politican)myVector.get(0);
pol2 = (Politican)myVector.get(1);
( ,
Tue 20 Apr 2004, 1:45,
archived)
myVector.add(politican1);
myVector.add(politican2);
inside the Vector, they are stored as nameless Objects to get them back, u need to use casting, and assign to new
variables
Politican pol1, pol2;
pol1 = (Politican)myVector.get(0);
pol2 = (Politican)myVector.get(1);
oh...
and u got 'import java.util.Vector;' first thing at the top of ur class file right...
( ,
Tue 20 Apr 2004, 1:46,
archived)
no
i stuck "import java.util.*" so it imports everything
i'll add .Vector and see if that helps
( ,
Tue 20 Apr 2004, 1:48,
archived)
i'll add .Vector and see if that helps