Java Threads Question:

Download Job Interview Questions and Answers PDF

What is the volatile modifier for?

Java Threads Interview Question
Java Threads Interview Question

Answer:

The volatile modifier is used to identify variables whose values should not be optimized by the Java Virtual Machine, by caching the value for example. The volatile modifier is typically used for variables that may be accessed or modified by numerous independent threads and signifies that the value may change without synchronization.

Download Java Threads Interview Questions And Answers PDF

Previous QuestionNext Question
What is the SwingUtilities.invokeLater(Runnable) method for?Which class is the wait() method defined in?