| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|||||||
| Java Interview / Technical Questions Kindly solve an many as questions you can. It will sharpen your skills and those solutions will help others too. |
![]() |
|
|
LinkBack | Thread Tools | Rate Thread | Display Modes |
|
|
#1 (permalink) |
|
Junior Member
Join Date: Jul 2006
Posts: 1,391
Thanks: 1 Thanked 18 Times in 18 Posts Thanks: 1
Thanked 18 Times in 18 Posts
Rep Power: 17
|
J2EE - What is the difference between transient variable, volatile variable
What is the difference between transient variable, volatile variable <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
|
|
|
|
|
|
#2 (permalink) |
|
Junior Member
Join Date: Apr 2008
Posts: 1
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
|
volatile modifier requests the Java VM to always access the shared copy of the variable so the its most current value is always read. If two or more threads access a member variable, AND one or more threads might change that variable's value, AND ALL of the threads do not use synchronization (methods or blocks) to read and/or write the value, then that member variable must be declared volatile to ensure all threads see the changed value.when you don't want to serialize a member variable then you define that variable as transient.
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need .Net Interview Questions | vidyasagarkumar | VB / ASP.NET Technologies | 6 | 06-09-07 01:37 AM |
| J2EE - What is the difference between classpath and path variable? | preethisingh | Java Interview / Technical Questions | 0 | 23-01-07 02:37 PM |
| J2EE - What is the difference between a field variable and a local variable? | preethisingh | Java Interview / Technical Questions | 0 | 23-01-07 01:59 PM |
| C language -What is the difference between declaring a variable and defining a variable? | GEEK | ds. c , c++ Interview / Technical Questions | 0 | 23-01-07 01:39 PM |
| Java Contest-13 with answers | keerthi | JAVA Technologies | 8 | 31-12-06 09:44 AM |