Just thinking... is there a way that I can call the class A (the one outside the TestClass) in main method? The codes here is only in a single file. Thanks.
Michael Morris
Ranch Hand
Joined: Jan 30, 2002
Posts: 3451
posted
0
Not without using reflection and a factory class, but then that begs the question, why not either rename the outer class A or better put it in a separate package and file. The inner class A hides the outer class just like a method local variable with the same name as an instance variable will hide it. Here's a reflection solution:
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher