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
What is the difference between long.class and long.type?
What are the different types of exception?
What are the different algorithms used for clustering?
What is colon_pkg_prefixes and what is its use?
What’s jboss jbpm?
Is the ternary operator written x : y ? Z or x ? Y : z ?
What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?
Difference between DurableSubscription and non- DurableSubscription?
When is the best time to validate input?
What is jboss?
Java is fully object oriented languages or not?
What is the argument type of a programs main() method?
Why are my checkboxes not being set from on to off?
What class is the top of the awt event hierarchy?
Do I have to use jsps with my application?