title: Working with anonymous class in Android
body: <p>I'm an android beginner, I have some java knowledge, but i'm getting trouble with some android code.</p>
  
  <p>In java we can use anonymous class to override methods of an interface.</p>
  
  <p>I came across the following situation.</p>
  
  <pre><code>MyButton.setOnClickListener(New Button.OnClickListener{
      @override
      public void onClick(View view){
        //some code
      }
  });
  </code></pre>
  
  <p>I was used to using the anonymous class like so, </p>
  
  <pre><code>Interface myInterface = new Interface(){
  }
  </code></pre>
  
  <p>I can't just figure out what only New followed by the interface name means,inside a method.</p>