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

jabber (jabber)
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.
2000-11-26 -05:00

回到话题: dummy question about private constructor

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论