tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cees van de Griend <c...@pobox.com>
Subject Re: about singletons (ot)
Date Tue, 28 Jan 2003 22:22:44 GMT
On Tuesday 28 January 2003 22:56, Felipe Schnack wrote:
>   These days I was thinking
>   It's not so uncommon to have uses for singleton classes in our
> everyday lives. Normally we do that implementing a class that have its
> constructor as private, so no one can instantiate it, and a
> getInstance() method or something like it. We wouldn't have the same
> kind of behavior if we simply declare all class methods/fields as
> static?

No, you don't. In this case you are able to create multiple instances of this 
class. Sure, you can create one, but is is not enforced.

With a singleton, only one instance of the class can be created.

Regards,
Cees.

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message