×

Loading...

dummy question about private constructor

ely (Ely)
I'm studying Java from the very begining. I read the following defination of private constructor:

"Private- No other class can instantiate your class. You class may contain public class methods and those methods can construct an object and return it, but no other classes can."
I tried to declare a public method to construct an object in the class but was confused with the syntax and i also don't know how to call this method in other classes since new object can't be created out of the original class.
Anybody can give me an example?Thanx!
(#15824@0)
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技术讨论