posted 20 years ago
A thought about instantiating anonymous subclasses of nested classes.
I think it is safe to say,
If C is a top-level, static member, non-static member or local class,
and C is not final, then where ever this is valid syntax to instantiate the class,
new C()
new Outer.C()
outerRef.new C()
new Outer().new C()
this is also valid syntax to instantiate an anonymous class.
new C() { <body of anon class> }
new Outer.C() { <body of anon class> }
outerRef.new C() { <body of anon class> }
new Outer().new C() { <body of anon class> }
[ August 14, 2003: Message edited by: Marlene Miller ]