//Er man opdaget?
if (Math.random()>0.5)
{
//Fjenden har ikke opdaget spilleren endnu,
//og man kan derfor nå at træffe et valg
System.out.println("Den har endnu ikke opdaget dig");
System.out.println("Hvad vil du?");
System.out.println("1 - Angribe");
System.out.println("2 - Flygte");
svar = tast.læsHeltal();
if(svar==1)
{
//kamp.angrib();
}
else if(svar==2)
{
//kamp.flygt();
}
else
{
System.out.println(svar + " er ikke et gyldigt svar");
}
}
//Fjenden har opdaget spilleren og angriber
else
{
Does "Tastatur" or "Sted" create a "Udforsk" object (thus creating an infinite recursive loop)?
You probably shouldn't be "new"ing other objects inside Udforsk unless you know that those object (or objects created inside those objects, or objects created inside those objects created inside those objects, etc) don't wind up creating a Udforsk object (making it infinitely recursive).
Does "Tastatur" or "Sted" create a "Udforsk" object (thus creating an infinite recursive loop)?
Yes one of them do. Changing that did not help, it still gives me the same silly error.
How do I access functions inside theese classes if I am not allowed to create a new instace of them?
As far as I know the only way to run methods from other classes is to do it this way.
You could use static methods so you don't actually need an instance of the class. Thjere seems nothing wrong with your code, though we don't have enough information ( also english comments/var names would be nice ) .
Check you aren't creating objects in a loop when it isn't really needed.