title: What is a call back interface in Java?
body: <p>This code snippet for the interface SetObserver is taken from <strong>Effective Java (Avoid Excessive Synchronization Item 67)</strong></p>
  
  <pre><code>public interface SetObserver&lt;E&gt; {
  // Invoked when an element is added to the observable set
  void added(ObservableSet&lt;E&gt; set, E element);
  }
  </code></pre>
  
  <p>And the <code>SetObserver</code> is passed  to <code>addObserver()</code> and <code>removeObserver</code> method as given below :</p>
  
  <pre><code>// Broken - invokes alien method from synchronized block!
  public class ObservableSet&lt;E&gt; extends ForwardingSet&lt;E&gt; {
    public ObservableSet(Set&lt;E&gt; set) {
      super(set);
    }
  
    private final List&lt;SetObserver&lt;E&gt;&gt; observers =
        new ArrayList&lt;SetObserver&lt;E&gt;&gt;();
  
    public void addObserver(SetObserver&lt;E&gt; observer) {
      synchronized (observers) {
        observers.add(observer);
      }
    }
  
  
  
    public boolean removeObserver(SetObserver&lt;E&gt; observer) {
      synchronized (observers) {
        return observers.remove(observer);
      }
    }
  
  
  
    private void notifyElementAdded(E element) {
      synchronized (observers) {
        for (SetObserver&lt;E&gt; observer : observers)
          observer.added(this, element);
      }
    }
  </code></pre>
  
  <p>Bloch refers to the <code>SetObserver&lt;E&gt;</code> interface  as a <strong>call back interface</strong> . When is a interface called an call back interface in Java? </p>