Which of the following modifiers can be used for a variable so that it can be accessed by any thread or a part of a program?
A. global
B. transient
C. volatile
D. default
Answer:C
Which of the following modifiers can be used for a variable so that it can be accessed by any thread or a part of a program?
A. global B. transient C. volatile D. default
Explanation: In Java, we can modify the values of a variable with the help of a reserved keyword known as volatile. It is a different way of making a class thread-safe. Thread-safe means that the methods and objects of a class are accessible by multiple threads at the same time.