hiwa said:
Inner class is a non-static nested class inside another class. That
means its existence depends on enclosing class's instance/object. In
other words, they can not have their own independent existence as a
sovereign class ... if enclosing class object is not created, inner
class can't have its existence, so they can't have static members.
Only an independent sovereign class can have its own static members.
And although the stated facts are all true, they do not constitute an
insurmountable problem. The fundamental answer is that Sun decided to
place the restriction for reasons of their own, even though the virtual
machine specification is not incompatible with inner classes having
static members. I don't work for Sun and never have, so I can only
speculate as to Sun's reasons, but I would place my bets in two areas:
(1) A philosophical objection based on arguments similar to those hiwa
gave above, and
(2) Reserving the possibility of a future JVM revision that may be
facilitated by the restriction.
John Bollinger
(e-mail address removed)