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?
Chris Gastin<br />SCJP 1.4<br />SCWCD 1.3
Joined: Aug 05, 2002
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 ]
Joined: Aug 29, 2002
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
Sab<br /> <br />Perfection does not come from belief or faith. Talk does not count for anything. Parrots can do that. Perfection comes through selfless work.<br />Swami Vivekananda