×

Loading...

dummy question about private constructor

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!
Report

Replies, comments and Discussions: