Design patterns using anonymous inner classes



I've been reading a document that states:

1. In Java a nested class can be declared in any block including methods.
2. The ability to create nested classes in methods in Java may seem unnecessary but combined with anonymous inner classes can provide a means of creating power design patterns.


Does anybody know which design patterns this author is referring to? Lexical closures perhaps?
.




Relevant Pages

  • Re: Access outer class members from a nested class
    ... the JAVA syntax of Outer.this.m_OuterValue does not exist apparently. ... The type of nested class you appear to be thinking of is an "inner class". ... An inner class has an implicit reference to an instance of the outer class, determined at the time of instantiation, based on the instance of the outer class that created the inner class. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: c# and java diffs
    ... I come from a Java background. ... C# has nested classes, ... If so, how are the docs generated, and does it create an HTML output? ... Well, your example is using generics, not defining one. ...
    (microsoft.public.dotnet.languages.csharp)
  • Nested class structures
    ... I would like the ability to have some of the nested classes ... going on there so I wind up with three separate classes which are bound ... to uniquely named attributes of class1. ... isn't really created until after all the nested class definitions ...
    (comp.lang.python)
  • Re: Access outer class members from a nested class
    ... outer class says you can't access non-static members. ... less explicit than the Java approach. ... light of the nested class behaving as a static member, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Why nested scope rules do not apply to inner Class?
    ... The whole point of nested class is to avoid polluting the namespace with classes that are only used locally. ... So the argument about the elegance of reusing is not very valid in that case. ... There is no point of nested classes because nested classes _are not_ ...
    (comp.lang.python)

Loading