You should make your IntNode
class static
.
If you don't, this means that an IntNode
instance cannot exist without an instance of the enclosing class already existing.
In short, you cannot write (provided IntNode
was public
of course):
new PrimeGenerator.IntNode(whatever);
but you'd have to create a new PrimeGenerator
, say generator
below, and write:
generator.new IntNode(whatever);
Here however you try and create an IntNode
as a class variable for PrimeGenerator
. This won't work, since you don't have an instance of PrimeGenerator
yet.