This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes what is volatile? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "what is volatile?" Watch "what is volatile?" New topic
Author

what is volatile?

deepak kushwaha
Ranch Hand

Joined: Jul 17, 2010
Posts: 33
i have see a question that say can a method be declared volatile. what that mean?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19655
    
  18

Volatile only applies to static and instance fields, and it means that the value will never be cached. As a result, all threads will always use the most up-to-date value.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tom Reilly
Rancher

Joined: Jun 01, 2010
Posts: 618
Here's a topic that discusses volatile.
Arun C. Giridharan
Ranch Hand

Joined: Jul 11, 2010
Posts: 96
ok,so if i have to assign multiple value for my attribute(state) ...how to do it???
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Arun Giridharan wrote:ok,so if i have to assign multiple value for my attribute(state) ...how to do it???

What?
deepak kushwaha
Ranch Hand

Joined: Jul 17, 2010
Posts: 33
thanks tom
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38062
    
  22
Probably best moved as too difficult for "beginning"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what is volatile?
 
Similar Threads
another thread question
Volatile
volatile keyword
volatile
volatile keyword