Open Means Open Means

Volatile Variable in java

Volatile variable is more useful in java. Now a days we using multithread in many

Java projects. During this we can use the volatile keyword.

Best scenario for using volatile variable:

In multiple thread concept may be single instance can be used by multiple thread .That time the volatile variable will be use for programmer...Because without volatile variable means if one thread will be changed by user it will affect by other threads also.

During this time we can mention master copy variable we mention as volatile variable..because of this other than master variable will be update value  it actually update in cache memory not in main memory variable memory

Declaring a volatile variable

Class exvolatile

{

volatile int val;

.....

}

No comments

Login to post a comment

Show
  • Create an account
  • Forgot your username?
  • Forgot your password?

Related Articles

  • About JSharp
  • JAVASCRIPT
  • JAVA tutorial and sample codes.....Introduction(part1)
  • Open and Close Windows using javascript
  • Closing the browser window using javascript
  • Fujaba Tool Suite For UML Modelling
  • JavaServer Faces vs Struts Framework
  • JavaServer Faces Unified Expression Language (EL)
  • Java Puzzle - Problem of Two Developers Part 2
  • Java Developer Kit(JDK)
  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions