title: Declaring Anonymous Inner class
body: <pre><code>rb.addActionListener(new ActionEvent(ae) {
     public void actionPerformed(ActionEvent ae) {
       nowCall(ae);
      }
  });
  </code></pre>
  
  <p><strong>Another way</strong></p>
  
  <pre><code>Thread th=new Thread(Runnable r) {
    public void run() {
      // do something
    }
  };
  
  // notice the ending of above 2 snippets
  </code></pre>
  
  <p>I am really confused seeing these two.It seems there is no exact pattern to declare an anonymous inner class.</p>
  
  <p><em>please explain the syntax for anonymous inner class.</em></p>