Hi,
during the beginners Java studies I got a littel problem when using the hashtable function.
With the folowing code I create object of the class "Kreis" and put them into a hashtable. see the following listing:
import java.util.*;
public class HaschDaten extends Object {
public static void main (String [] args) {
Hashtable hash = new Hashtable();
Object test;
int i, xValue;
for (i=1; i < 10; i++) {
String str = ("Kreise" + i);
System.out.println("Test: " + str);
xValue = i * 100;
test = build(xValue,100,100);
hash.put ("Kreise" + i ,test);
}
}
public static Kreis build(int x, int y, int z)
{
return new Kreis(x,y,z);
}
}
The class "Kreis" includes a methode getX() to get back the private declared variable x.
My problem is that I want to read an Object from the hashtable and execute the getX() Methode of this particluar class.
How can I read f.e the 4 Object from the hashtable and start the getX() methode for this object.
Thanks for your help.
Thomas