aspose file tools*
The moose likes Beginning Java and the fly likes Volatile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Volatile" Watch "Volatile" New topic
Author

Volatile

Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
Hi all,
Volatile is used for a variable which can be modified asynchronously. How can modify a variable asynchronously?
Please help
Harish
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

This modifier is used to identify a variable which can be modifed by different threads. So 'volatile' is suppose to tell the compiler to not perform certain optimizations on the variable.
So for example: you make two instances of ThreadClassA. In ThreadClassA there is a variable named 'VolatileTemp'. Each instance of TheadClassA can than change 'VolatileTemp' at will.
Did that answer your question in anyway?


Please ignore post, I have no idea what I am talking about.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Volatile