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 -04:00
This post has been archived. It cannot be replied.
Page address has been copied. To share, click to copy page address.
Share Online by QR Code

Back To Topic: dummy question about private constructor

Back To Forum: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论