Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access a shadowed class?

 
Richard Hayward
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inside ClassChoiceTest, the class AClass is shadowed by a nested class definition of the same name.



Is there any way to refer to the non-nested AClass from inside ClassChoiceTest?
 
Paul Anilprem
Enthuware Software Support
Ranch Hand
Posts: 3752
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is possible but there is a catch. You have to define the classes in a non-default package and then you can access the non-nested class using the packagename.Aclass. You can't do this with default package because it is not possible to "import" the default package.

HTH,
Paul.
 
Richard Hayward
Ranch Hand
Posts: 101
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Paul.

Regards
Richard
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic