I can't understand oracle java tutorial that writes:
public class SyntheticConstructor {
private SyntheticConstructor() {}
class Inner {
// Compiler will generate a synthetic constructor since
// SyntheticConstructor() is private.
Inner() { new SyntheticConstructor(); }
}
}
Since the inner class's constructor references the private constructor of the enclosing class, the compiler must generate a package-private constructor.
Aucun commentaire:
Enregistrer un commentaire