Hi Harwinder,
Q: Why are inner classes not allowed to have static members (except constants)?
----
First some background info for perspective to appreciate the question and the answer.
Before I came to the JavaRanch I tried to learn from the experienced and talented folks at the Sun Advanced
Java forum. This particular question came up time and time again. They spent pages and page, hours and hours debating and guessing. No one there presented a convincing reason. Do a search there or here and you will find lots of guesses and fuzzy reasons.
There are no clues in the JLS or The Java Programming Language.
One day, in the middle of someone else�s post on nested classes, I inserted the famous question: (I wish someone could explain why inner classes cannot declare static members.)
Jim Yingst presented a convincing explanation. As far as I am concerned, Jim walks on
water. Save his answer, you may never find another nearly as good. It takes some patience to work through his answer. But that�s due to the nature of the question.
----
inner classes and static members My question is at June 27 2:33 PM. Jim�s answer begins at June 29 3:08 PM.
[ January 14, 2004: Message edited by: Marlene Miller ]