Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inner Classes and Access Modfiers

 
Chris Gastin
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been searching this message board, on this topic, and i ahve to admit I am sort of confused. Could someone answer the following questions to clarify for me.
What access modfiers can be used with Static Inner Classes?
What access modfiers can be used with Member Inner Classes?
What access modfiers can be used with Local Inner Classes?
 
Barkat Mardhani
Ranch Hand
Posts: 787
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What access modfiers can be used with Static Inner Classes?
If you are refering to top level nested class (static), then it can have all available access modifiers.
What access modfiers can be used with Member Inner Classes?
If you are refereing to Non-static inner class, again answere is same.
What access modfiers can be used with Local Inner Classes?
None
[ September 10, 2002: Message edited by: Barkat Mardhani ]
 
Sabarish Sasidharan
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider static nested top level classes to be like normal static members you have in ur class(like static variables and static methods). Hence they can have all the access modifiers applicable to static members.
Similarly nonstatic inner classes are similar to the instance members we have in classes and hence enjoy all the access modifiers applicable to nonstatic innner classes.
Local inner classes are just like local variables and similar to the local variables they do not have any access modifiers.
Hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic