• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

volatile

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
we say that volatile changes the orginal copy of the variable i.e
reading and writing on the variable produces changes in the master copy of he variable
so does this also not happen in the case of static variable
I think ia hve got wring notions of the volatile variable
ps anyone expalin me the details of volatile keyword.
 
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is the definition for volatile kerword:
Volatile is a Java programming language keyword used in variable declarations that specifies that the variable is modified asynchronously by concurrently running threads.
Roopa

Originally posted by devesh singh:
we say that volatile changes the orginal copy of the variable i.e
reading and writing on the variable produces changes in the master copy of he variable
so does this also not happen in the case of static variable
I think ia hve got wring notions of the volatile variable
ps anyone expalin me the details of volatile keyword.


 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
still I am not very clear with it ps tell me where do we use this and for what purpose
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Volatile tells the computer that a variable may change asynchronously due to threads. Declaring a variable to be volatile makes the compiler forego optimizations that might turn the variable into a constant and eliminate the possibility of it changing asynchronously. "from Java 2 by Barry Boone/William Stanek"
Definition of asynchronously: unsynchronized events, for example, the time interval between event A and B is not the same as B and C. " from The Computer Glossary"
Also, as per RHE book, volatile is not an the exam.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic