• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is volatile keyword in Java?
Answerpail.com Question and Answer Website
What is volatile keyword in Java?
Declaring a volatile Java variable means: The value of this variable will never be cached thread-locally: all reads and writes will go straight to "main memory"; Access to the variable acts as though it is enclosed in a synchronized block, synchronized on itself.
Holle Everyone..!
It's probably fair to say that on the whole, the volatile keyword in Java is poorly documented, poorly understood, and rarely used. To make matters worse, its formal definition actually changed as of Java 5. On this and the following pages, we will cut through this mess and look at what the Java volatile keyword does and when it is used.
Volatile keyword in Java is used as an indicator to Java compiler and Thread that do not cache value of this variable and always read it from main memory .
Volatile keyword is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time--without any action being taken by the code the compiler finds nearby. A variable should be declared volatile whenever its value could change unexpectedly.
Cheap VPS | $1 VPS Hosting
Cheap Windows VPS | Windows with Remote Desktop Access
Cheap Dedicated Server | $29 Dedicated Server with Free IPMI
I'm also wondering about this issue! Expert in solving help me!

Possibly Related Threads...
Thread Author Replies Views Last Post
  encapsulation in java..? mahisharma3200 1 171 09-11-2018, 11:15 PM
Last Post: sankalppatil
  Differentiate between StringBuffer and StringBuilder in Java programming. sulbha 1 117 09-11-2018, 11:11 PM
Last Post: sankalppatil
  Java or php? sumitmodi 16 1,322 09-08-2018, 12:33 AM
Last Post: TangelThor
  What is difference between CyclicBarriar and Countdown Latch in Java ? sulbha 1 295 03-05-2018, 02:49 AM
Last Post: WebExpert
  Net or Java on Linux? confused after .Net is Open Source richardwalter 2 378 02-14-2017, 02:41 AM
Last Post: John Cage
  How to write data from MySql table to Excel using Java - See more at: https://www.gid richardwalter 0 328 02-11-2017, 04:47 AM
Last Post: richardwalter
  Java Help please.. richardwalter 0 290 02-04-2017, 06:03 AM
Last Post: richardwalter
  What Differs JavaScript from Java ? beingchinmay 0 768 01-07-2016, 01:28 AM
Last Post: beingchinmay
  JavaScript Resembles Java beingchinmay 0 578 01-07-2016, 12:56 AM
Last Post: beingchinmay

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

Webmasterbabble.com, © 2012-2018 .