title: would it be possible add attributes to an anonymous class instead only overwrite its methods?
body: <p>I was wondering if is possible to add properties to an annonymous class in JAVA?, maby is an easy question but the trick here is that I saw some codes on google that were doing it but when I tried in Netbeans it didn't happened.</p>
  
  <p>I created an instance of the class in the annonymous way but instead of overriding the method i add other and a variable and the instance was an simple, in google others dudes made this classes all on the fly an I couldn't why?</p>
  
  <pre><code> public class Cat(){ 
   public void sayMew(){}
   }
   Cat gato = new Cat{
    @Override
    public void sayMew(){System.out.println("mew"); 
   };   
   gato.sayMew(); //This works fine.
  
   //Some code over there do this and it didn't work for me:
   Cat gato = new Cat(){
    int legs = 4;
    public void scratch(){System.out.println("scratch"); 
   };   
  //Even I saw this king of instances be pointed by variables types :/ what 
  am I doing wrong?
  </code></pre>