Sanjay,

There exists a Design Pattern which goes by the name of "Singleton", which
allows you to make one (and only one) instance of an object. When an instance
already exists, trying to create a new one returns you the existing one (you can
modify this to throw an exception instead).

In the future, would you be kind enough to post your questions in the
appropriate list? Every time an off-topic question is posted here, tons of
replies are also posted, which can be very annoying (remember, if the question
is off-topic, those replies are also off-topic). Thanks!

Pat.


Sanjay Vashisht wrote:

> Hi All
>
> This is an off-topic but an interesting question?
> can i have only one object for a class defined. If user try to create
> one more object that should be an Exception or error condition.
>
> Thanks in Advance.
>  Rgds
> Sanjay
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to