KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
If in a class I have a ConcurrentHashMap instance that will be modified and read by multiple threads I might define like this: public class My Class { private volatile ConcurrentHashMap<String,String> myMap = new ConcurrentHashMap<String,String>(); ... } adding final to the myMap field results in an error saying I can only use final or volatile. Why can it not be both?
Tags (comma-separated)
Save Edits
Cancel