title: Invoking a method in anonymous (inner) classes
body: <pre><code> interface Example{
     void methodExample();
   }
   class Y{
    void do(Example x) { }
  }
  
  class X{
     void methodX() {
       Y y = new Y();
       y.do(new Example() {
         public void methodExample() {
           System.out.println("methodExample");
         } 
       });
     } 
   } 
  </code></pre>
  
  <p>I want to create a main class and call <code>methodExample</code>. How would I do that?</p>