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
int x=5,i=1,y=0; while(i<=5) { y=x++ + ++x; i=i+2; } System.out.println(x); System.out.println(y); System.out.println(i); How to solve this? Please explain!
What is a class loader?
Is there a guarantee of uniqueness for entity beans?
What are the types of scaling?
What is JTS?
What is metaspace?
what is a portable component?
how i secure my site with the https protocol.what are the steps?
How many times may an objects finalize() method be invoked by the garbage collector?
What is a session? Can you share a session object between different theads?
difference between ejb,struts,hibernate,spring and jsp
Is jvm a overhead?
Where we can write Rmi registry in the code, without having to write it at the command prompt?
What is a modular application?
If your ui seems to freeze periodically, what might be a likely reason?