aspose file tools*
The moose likes Beginning Java and the fly likes volatile keyword Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "volatile keyword" Watch "volatile keyword" New topic
Author

volatile keyword

ShivaKumar
Greenhorn

Joined: Apr 02, 2002
Posts: 1
what is the significance of volatile keyword in java?
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Volatile forces variable modifications to be visible to multiple threads. It's not something that the average Java programmer will ever have to worry about.
But if you start doing a lot of concurrent programming, you will probably use this. It's one way of allowing concurrent access to a variable by multiple threads without having to use synchronization locks, which can speed up a program's execution. It works best for optimizing situtiations where one thread is writing to a variable, and multiple threads are reading from that same variable.
[ April 02, 2002: Message edited by: Rob Ross ]

Rob
SCJP 1.4
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
ShivaKumar,

Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy. (You need to have a space in there).
Thanks again and we hope to see you around the ranch!!
Cindy


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: volatile keyword