I'm getting a very strange error. I have the following code:
while (true) {
    System.out.println(model.getLightState());
    if (model.getLightState() == 1) {
        System.out.println("Entered..");
        view.driveThroughJunction();
        break;
    }
}
Now, my program enters the if statement when the light state changes to '1' and executes the code that's fine. But this ONLY works if I have that print out statement after the while loop is entered. I find that weird. Will a 'sysout' line have any effect on the if statement? Apparently it does for the above case.
Any ideas to why this is ?
EDIT:
(in the model class)
public final byte getLightState() {
    return lightChanger.getLightValue();
}
(in lightchanger class)
public byte getLightValue() {
    return light.getState();
}
(in the light class)
public final byte getState() {
    return this.state;
}
 
     
     
    