My question is that when I put the Class : MyInner in another file in the same package, then why doesnt it get recognized in the Class MyOuter? I have made the font bold where it throws error. [ August 14, 2008: Message edited by: Somnath Paul ]
Originally posted by seetharaman venkatasamy: you can not create instance of innerclass from different class(other than outer class)
Yes you can, as long as a) it's visible, and b) you have a reference to an enclosing outer class.
the problem in your code is that MyInner is NOT an inner class - it's a toplevel class instead. If you want it to be an inner class, you should put the entire class definition inside the class definition of MyOuter. Basically, just move the last } of your outer class to after the inner class (and then fix indentation).
You might want to know that, from an inner class, you can get a reference to its outer class by calling MyOuter.this [ August 14, 2008: Message edited by: Rob Prime ]