What is Anonymous Inner Class ?

Discussion in 'Inner Classes' started by vbraojava, Sep 10, 2008.

  1. vbraojava

    vbraojava New Member

    An Inner Class declared within the body of a method without naming it. These classes are known as Anonymous Inner Classes.
     

  2. Anonymous inner classes have no name and therir type must be either a subclass of the named type or an implements of the named interface.

    An annonymous inner class is always created as a part of a statement closed after definition with a curly braces follwed by semicolon.

    An annonymous inner class can extend one subclass or implements one interface.

    example

    class A {
    public void Aa(){
    }
    }

    class B{

    A a = new A(){

    public void Aa(){
    }

    };

    }
     
  3. anneroberts

    anneroberts Member

    An inward class announced without a class name is known as a mysterious internal class. If there should be an occurrence of unknown inward classes, we pronounce and instantiate them in the meantime. By and large, they are utilized at whatever point you have to supersede the technique for a class or an interface.
     

Share This Page