Why have we declared the instance reference volatile?



Why have we declared the instance reference volatile?..

Answer / Prashant Sharma

Declaring an instance reference as 'volatile' in Java ensures that changes to the variable are visible to all threads. This is useful when dealing with shared state between multiple threads, preventing issues like race conditions.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Design Patterns Interview Questions

Shall we use abstract classes or interfaces in policy / strategy design pattern?

1 Answers  


What is viper architecture?

1 Answers  


What is Software development life cycle....??

5 Answers   TCS,


What are the design patterns and How can they make life easier for software development ?

1 Answers   ABC, HP,


Give the syntax of css?

1 Answers  


What is a lazy initialization in singleton?

1 Answers  


What according to you will be the next best thing in UI UX Design?

3 Answers  


Contact a small, medium, and a large contract program within your organization. Interview the Technical Director or Project Engineer to identify the following information: a. Request the individual to graphically depict their development strategy? b. What factors drove them to choose the implementation strategy? c. What were some of the lessons learned from developing and implementing the strategy that would influence their approach next time? d. How was the V & V strategy implemented?

1 Answers  


What is software 'quality'?

2 Answers  


when performing a functional test on a phone calculator,if pressing on a button does not function what do i do next

4 Answers   IBM,


What is a pattern library?

1 Answers  


What are useful tools for developing and testing color schemes for web sites?

1 Answers   Wipro,


Categories