Need Help: Java volatile keyword

Can anybody tell me the exact meaning of volatile keyword in Java. Also what
is the use of it. A sample program using this keyword would help me a lot.

Can anybody explain the realtime example of this keyword.

Thank you

You’ll have to read the whole page for what you’re looking for:

volatile isn’t used much as far as I can tell. In fact I bet I’ve never even used volatile in a program. But I could be wrong, I’ve been programming for a while now… :slight_smile:

I don’t have an example that would use the volatile key word either. Best of luck with your homework.

Hi Every one
I experienced problems with a class being serialized with an incorrect (old) value until I added the volatile declaration. This happened with a boolean value that would often be changed immediately prior to serialization.