I have a method in class A which creates a thread and invokes the run method in class B. I have a list in class B that is updated in run method of class B and I need to access that in class A after the run method returns. I have given the sample code below. 

```
class A {
    public static void main(String[] args) {

        List l = null;

        B obj = new B();
        Thread T = new Thread(obj);
        T.start();

        l = obj.getList();
        // do something with l    
    }
}

class B implements Runnable {

    List l;

    void run() {
        l = doSomething();    
    }

    public List getList() {
        return List l;
    }
}

```

Now I am getting null when i get the list value `l = obj.getList();` which is in the class A. The line `l = obj.getList();` in class A is immediately gets called before it gets updated by the run method. How to make the main thread wait and display the correct value after the thread T returns. Kindly suggest?