This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Lets look at this way, the inner class is a member ( instance) variable (assume like that not the same) for the outer class. So it is like if you are declaring the instance methos in a class. Now think, can you declare a static variable inside the method?
So just like inside the instance declaration of a inner class you cannot declare static variables.
If you want to, declare inner class as static.
We appreciate the static members because they are available to us as ready to use without creating the new instance of the of the enclosing class i.e without the headache of "new"
Let assume we have class called "Outer" and which has non static inner class called "Inner".
Is there way to access the members of "Inner" class without crating the instance of Outer class ?
No! we can't access them.
If we can't access the members of "Inner" class without creating instance of "Outer" class. then what is the use if we have the static member in "Inner" class. hence compiler won't allow us have static members in non static inner class.