title: Simple Java Callback is not working
body: <pre><code>interface CallableInterface
  {
      void callBackMethod();
  }
  
  class Worker
  {   
      public static ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;();
      static Timer t = new Timer();
  
      public void addToList(String newAdd, CallableInterface callback)
      {   
          names.add("BMW");
          names.add("DODGE");
  
          t.schedule(new TimerTask() {
              @Override
              public void run() {     
                  names.add(newAdd);
              }
          }, 5000);
  
         callback.callBackMethod();
      }
  
      public void printList(){
          System.out.println(Worker.names);
      }
  }
  
  
  class Boss implements CallableInterface
  {   
      Worker w1 = new Worker();
  
      public Boss(String carName)
      {   
          w1.addToList(carName, this);
      }
      public void callBackMethod()
      {
          w1.printList();
      }
  }
  
  
  public class IntroCallbacks
  { 
      public static void main(String[] args)
      {
          Boss b = new Boss("Mercedes");   
      }
  }
  </code></pre>
  
  <p>I am simulating a network delay using a timer. The idea is to wait for the timer to finish (in this case 5 seconds) and then to print the arrayList. No matter what i do to the code i always get [BMW, DODGE] only.  </p>
  
  <p>It should be [BMW, DODGE, MERCEDES].</p>
  
  <p>What am i missing?</p>