Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner Class

 
Nelson Nadal
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Nelson Nadal
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sir Morris... I appreciate
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic