I have been trying to post to .help all day but nothing is going
through. Will try it here and hope it does....
I am trying to access a getData() method that simply returns a stored
integer value from an object that is stored in a vector. I have tried
to do this but cannot get the notation correct. I tried google groups
and the only thing I got from there was to pull the object from the
vector into a temperary object. That didnt work.
So, here is the code I have so far of making the temp object and
making sure it is actually pulling one out. I still connot figure out
how to access the getData() method.
Any hints are appreciated.
import java.util.Vector;
public class StackUser
{
public static void main(String argv[])
{
Vector vector = new Vector();
for (int i = 0; i < 100; i++)
vector.add(i, new StackNode());
System.out.println(vector.get(0));
Object tobj = vector.get(0);
System.out.println(tobj);
}
}
public class StackNode
{
private int value = 0;
public StackNode()
{
value = (int)(Math.random());
}
public int getData()
{
return value;
}
}