Hi, I am new in JAVA programming. Can anybody explain to me , how can I catch a change of Boolen expression and then make a action. I need to alter a Boolean expression (it's public) from different point's of program, and after any change start some other code.
Your question is a bit vague. What do you mean by "catch a change of a boolean expression"? Can you show us some code to explain in more detail what exactly you want to do and what you don't understand?
You can use if ... else statements to execute statements depending on if a boolean expression evaluates to true or false.
Well Might be I didn't get the question. But if you need to track a Boolean variable in Whole Application, then it would be better to run a parallel thread to check whether the value of boolean variable has been changed or not.
I am sorry if I mislead the thread. But I suggested what I thought about.
The Best way to predict your future is to create it - Every great individual common man
posted 12 years ago
thank's for helping. I done it with parallel thread.
Originally posted by Ankur Sharma: Well Might be I didn't get the question. But if you need to track a Boolean variable in Whole Application, then it would be better to run a parallel thread to check whether the value of boolean variable has been changed or not.
Better than what?
I think typically the best solution would be to encapsulate the boolean in an observable object - an object that fires a change event every time the value changes.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus