mardi 11 avril 2017

Why can a static inner member class access the outer private constructor [duplicate]

This question already has an answer here:

Quote from here, a static inner member class can

1) It can access static data members of outer class including private.

2) Static nested class cannot access non-static (instance) data member or method.

As I understand, a constructor is not static in java. But in builder pattern, a static inner class can also access the private outer constructor. Why is that, and what's the logic behind this design?

Aucun commentaire:

Enregistrer un commentaire