I want to update a class attribute (the class is extending Thread) in the run() method, I do it like so:
public class ClassProcessing extends Thread {
    volatile public List<String> processedList ;
    
    ...
    
    public void run() {
    
      ....
      String processedElement = ....
    
      this.processedList.add(computedElement);
    }
Doing like so returns java.lang.NullPointerException: Cannot invoke "java.util.List.add(Object)" because "this.processedList" is null
How to solve this? Thanks.
 
    