A
A. Meyer
Hello everybody,
I have a recursive problem, which I tried to solve by defining a class,
which contains an attribute whose type the class itsself. The
(test)-programm looks then as follows:
package main;
public class Test {
private Test myTest = null;
public boolean isTestNull(){
if (this.myTest==null)
return true;
else
return false;
}
public void modifyMyTest(){
myTest = new Test();
}
}
Ist this good prgramming style or is it a kind of dirty solution?
Anyway, I have tried the solution and it seems to work. Plz give me
feedback.
Thx in advance
Amir
I have a recursive problem, which I tried to solve by defining a class,
which contains an attribute whose type the class itsself. The
(test)-programm looks then as follows:
package main;
public class Test {
private Test myTest = null;
public boolean isTestNull(){
if (this.myTest==null)
return true;
else
return false;
}
public void modifyMyTest(){
myTest = new Test();
}
}
Ist this good prgramming style or is it a kind of dirty solution?
Anyway, I have tried the solution and it seems to work. Plz give me
feedback.
Thx in advance
Amir