Hier ist ein Beispiel Projekt bei dem der Fehler auftritt.
Hi we've got a little problem and it would be good if someone could answer us as quik as possible. We want to do a bit larger projekt in wich you cant avoid calling from the first class a second class and then from this class another. Until now it works but if you want to call up the second class from the third class you'll get a StackOverflow Error message -.-
Here is a example projekt, where the Error message comes up.
erste Klasse/ first class:
- Code: Select all
import lejos.nxt.*;
import javax.microedition.lcdui.*;
public class Test1
{
public Test1()
{
}
public void Init()
{
LCD.drawString("Test1",0,0);
}
public static void main(String[] args)
{
Test1 test1 = new Test1();
Test2 test2 = new Test2();
test1.Init();
test2.Init();
while (true){
try {
Thread.sleep(100000);
} catch(InterruptedException ie) { }
}
}
}
zweite Klasse/ second class:
- Code: Select all
import lejos.nxt.*;
import javax.microedition.lcdui.*;
public class Test2
{
Test3 test3;
Test1 test1;
public Test2(){
test1 = new Test1();
test3 = new Test3();
}
public void Init()
{
LCD.drawString("Test2",0,1);
test3.Init();
}
}
dritte Klasse/third class:
- Code: Select all
import lejos.nxt.*;
import javax.microedition.lcdui.*;
public class Test3
{
Test2 test2;
public Test3()
{
test2 = new Test2();
}
public void Init()
{
LCD.drawString("Test3",0,2);
}
}
Hat jemand für dieses Problem eine Lösung?
Danke schon mal im voraus!
Has someone a solution for this problem?
Thanks in advance!
