posted 23 years ago
avn,
When you say, Outerclassname.innerclassname a1 = new Outerclassname().new innerclassname();, you have created an object of the nested class type that is associated with the object of the outerclassname. We are creating an object of type innerclassname in the context of the object Outerclassname.
However, within non-static methods that are members of Outerclassname, you can use the class name innerclassname without any qualification as it will be automatically qualified by the compiler with the this variable. So you could create new innerclassname object from within the method of the object Outerclassname:
innerclassname a2 = new innerclassname();
which is equivalent to:
this.innerclassname a2 = this.new innerclassname();