Is it possible to make an array volatile?

Answer Posted / glibwaresoftsolutions

It is not possible to create a volatile with Java. Only individual variables in Java can use volatile keywords; arrays and collections cannot. When a variable is specified as volatile, its value is never cached in a thread's local memory; instead, it is always read from and written to the main memory. This makes it simpler to ensure that any changes made to the variable are visible to all threads that access it.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we change the value of static variable?

705


Is main is a keyword?

789


What is string in java with example?

697


Do I need java for windows 10?

763


Difference between arraylist and hashset in java?

782


What are the features of junit?

820


How do you start a thread?

767


What is the maximum size of arraylist in java?

709


What is Classloader in Java?

824


Can you inherit from an abstract class java?

745


What do you mean by an interface in java?

764


Describe different states of a thread.

773


What is java command?

788


What is the benefit of abstract class?

710


What is complexity and its types?

727