Galois271@gmail.com wrote:
>>> If something is declared private, then why would it also be
>>> declared
>>> static? I saw this being used in an inner class.
Roedy Green wrote:
>> same reason anything else would be declared static, you need only
>> one
>> of them in the entire JVM, not one per object.
Actually, that's not guaranteed by 'static'. A JVM can have more than one
occurrence of a static field, or to be more precise, a JVM can load more than
one static field from the same bytecode if loaded by different loaders.
> Though this must be a method (or perhaps a constant), since inner
> classes can't have non-constant static fiields.
Actually, static methods are forbidden to inner classes also:
<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.3>
> Inner classes may not declare static members,
> unless they are compile-time constant fields (§15.28).
and
<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.6>
> members of the class, that is, fields (§8.3), classes (§8.5), interfaces (§8.5)
> and methods (§8.4).

Signature
Lew