I am wondering if it is possible in Java to to something like this.
class Running extends Thread {
private int value;
public void run() {
while (true) {
do stuff;
}
}
public int getValue() {
return value;
}
}
public static void main(String[] args){
Running runner = new Running();
runner.start();
int runnerValue = runner.getValue(); // Will I ever get the value?
}
[Edit]
I'm would also like to know if this is recommended or not?
[Edit2]
I'm aware that the value can get screwed up if it is changed in the run() method. The case I was more interested in is actually
private final int VALUE = 100;
Sorry about the ambiguity.