what is singleton class? where it mainly used in the
projects?

Answer Posted / suresh jv

Singleton class is a class, it allows jvm to create only one
object.
note:
most of the people think that servlet is a singleton class.
but it is not a singleton class. Actually for each servlet
one object will be created by container.
But suppose if u want to create another object for same
servlet, that servlet allows us to create another object but
the container (server) will not allow to create second object.

When a huge amount of requests coming to servlet, some of
the servers (espcially weblogic)allows to create second
object for same servlet to handle huge amount of requests,
then how can u say servlet is a singleton class.
"The class, itself doesn't allow to create second object "
is called singleton class.

this helps a lot u.....

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between long.class and long.type?

564


What are the different types of exception?

571


What are the different algorithms used for clustering?

550


What is colon_pkg_prefixes and what is its use?

1999


What’s jboss jbpm?

581






Is the ternary operator written x : y ? Z or x ? Y : z ?

639


What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?

572


Difference between DurableSubscription and non- DurableSubscription?

1714


When is the best time to validate input?

608


What is jboss?

573


Java is fully object oriented languages or not?

541


What is the argument type of a programs main() method?

563


Why are my checkboxes not being set from on to off?

644


What class is the top of the awt event hierarchy?

578


Do I have to use jsps with my application?

582