What are the two main uses of volatile in Java?



What are the two main uses of volatile in Java?..

Answer / Vitesh Kumar

Volatile is used to ensure that the changes made to a variable by one thread are immediately visible to other threads, and it also ensures that the Java compiler does not optimize away certain operations like looping.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the difference between logical data independence and physical data independence?

1 Answers  


What is the use of default method in interface in java?

1 Answers  


what happens when a thread cannot acquire a lock on an object? : Java thread

1 Answers  


What is a locale?

1 Answers   Aspire, Infogain,


Explain about public and private access specifiers?

1 Answers  


Can we declare main () method as non static?

1 Answers  


how an we achive multiple inhetitance in java using interface..??

2 Answers  


Can we call a non-static method from inside a static method?

1 Answers  


where exactly collections are usefull in realtime

2 Answers  


How does map works in java?

1 Answers  


What is a substitution variable?

1 Answers  


What is vector?

1 Answers  


Categories