0
Variable checker? Java
Is it possible to check if a variable has changed, so that Methode use then new variable? (But I don't mean a timer. I mean something that only run when the variable change.) Java Thanks
6 Answers
0
A TimerTask would be my first idea, it only has to fire every second
+ 1
You could restrict the acces to the variable making it private. Then you create a setter. Now the variable has to be changed through the setter and you know when it's updated.
+ 1
Like you wanna check if the time changed?
0
But (how) can I use this for something like a clock? So that it auto refresh the methode of the clock.
Thanks for the answer.
0
Yes.
0
So, that the the clock print out every time when a second is over. Or is a timer the only way?