tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cees van de Griend <>
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.


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message