 class TestAnonymous
 {    
 
     public static void main(String[] args)
     {      
         final int d = 10;
         
         father f = new father(d);
         
         father fAnon = new father(d){                
           // override method in superclass father
           void method(int x){     
             System.out.println("Anonymous: " + x);       
           }
           
           // overload method in superclass father
//           void method(String str) {
//              System.out.println("Anonymous: " + str);
//           }

            // adding a new method produces compile error
//            void newMethod() {
//                System.out.println("New method in Anonymous");
//            }
            
         };

//       fAnon.method("New number");  // compile error
//         fAnon.newMethod();         // compile error
         
     }
 
 } // end of ParentClass
 
 class father
 {   
     static int y;
     
     father(int x){ 
         y = x;
         this.method(y);
     }
     
     void method(int x){
       System.out.println("integer in inner class is: " +x);
     }     
  }  
