×

Loading...

Private constructor is related to some design patterns such as the Singleton Pattern

Take java.lang.Runtime as an example. There is only ONE Runtime for a JVM. Everybody can get that one as follows:
Runtime rt = System.getRuntime();

But nobody is allowed to create a Runtime.
---The constructor of Runtime is private, and correspondingly, Runtime is infertile.
Report

Replies, comments and Discussions: