SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




VOLATILE MODIFIER QUESTION.

        

Reply
 
LinkBack Thread Tools Display Modes
Old 15-01-07, 02:56 PM   #1 (permalink)
Senior Member
 
Join Date: Aug 2006
Age: 29
Posts: 279
Thanks: 0
Thanked 9 Times in 9 Posts
Rep Power: 7 radhika743 will become famous soon enough radhika743 will become famous soon enough
VOLATILE MODIFIER QUESTION.

Dear Friends, I want to know about "VOLATILE" Modifier in Java.

What is VOLATILE MODIFIER?

What is it's Use in Java?

Where do we use it in Java?

Can anybody explain it with programming example?

radhika743 is offline Offline   Reply With Quote
Old 17-01-07, 01:35 PM   #2 (permalink)
Moderator
 
t_mohan's Avatar
 
Join Date: Apr 2006
Location: India
Posts: 637
Thanks: 57
Thanked 91 Times in 70 Posts
Rep Power: 20 t_mohan has much to be proud of t_mohan has much to be proud of t_mohan has much to be proud of t_mohan has much to be proud of t_mohan has much to be proud of t_mohan has much to be proud of t_mohan has much to be proud of t_mohan has much to be proud of
Re: VOLATILE MODIFIER QUESTION.

Hi radhika,

I have never used Volatile modifier, and am not sure how does it work, Pls find the URL , you can get some info on this. go thru the site and let me know your questions, if u dont understand feel free to ask me, I 'll try to figure it out and will answer to ur questions

http://java.sun.com/docs/books/jls/s...asses.doc.html

Thank You
t_mohan is offline Offline   Reply With Quote
Old 03-10-07, 04:10 PM   #3 (permalink)
Member
 
harikotha's Avatar
 
Join Date: Oct 2006
Posts: 66
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 4 harikotha will become famous soon enough
Re: VOLATILE MODIFIER QUESTION.

HI Radhika,
In simple terms about volatile , u will declare any variable as volatile when there is in need of accessing by more than one thread , then volatile gives the fresh copy of that variable to each thread .. i.e
say 2 threads A,B are using a non volatile variable called x=10,then first thread A is accessing the x var.after completion of thread A excution may be var x modified by A due to performing some operations so imagine now x= 20, in this case if thread B will access this var x then x value will be 20 , and ur requirement is for each thread u have to supply the default value of x as 10 ,so it's not possible by using any other modifier , now if u declare the var x as volatile then JVM will give a fresh copy of x to each thread excution.

Thanks

Last edited by harikotha; 03-10-07 at 04:15 PM..
harikotha is offline Offline   Reply With Quote
Reply

Tags
modifier , question , volatile


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interview questions you may be asked yathish HR Questions 6 24-12-06 08:35 PM
Generic Question toshivain HR Questions 3 24-12-06 02:07 PM
Simple (??) question: List test cases for File/Open feature in Microsoft Word slinkanand Testing Tools & QA 2 01-11-06 07:18 PM
very good Question Unregistered Success Stories 1 11-09-06 04:53 PM
want interview question & answer pankajmurai NETWORK ADMINISTRATION , HARDWARE & TROUBLESHOOTING 1 20-07-06 11:32 AM


All times are GMT +6.5. The time now is 03:26 PM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.2