what is singleton class? where it mainly used in the
projects?
Answer Posted / jhuma
singleton class is such kind of class in which only one
object is created throughout the life time of the class.
class Singleton
{
public static Singletone si;
private Singletone()
{
si=new Singletone();
}
public static Singletone show()
{
return si;
}
public static void main(String ar[])
{
Singleton s1=Singletone.show();
}
}
| Is This Answer Correct ? | 44 Yes | 22 No |
Post New Answer View All Answers
How substring() method of string class create memory leaks?
AS a developer will u create a data source in connection pool? If so how will u do that, how to access the object from connection pool using IRAD tool?
What is the difference between session and entity beans?
What is the difference between the string and stringbuffer classes?
Name the eight primitive java types.
Have you used threads in Servelet?
How a component can be placed on Windows?
How to implement RMI in Java?
In RMI, inorder to sent the stub reference to the client, is we have to load the server object first into the memory or can we directly sent reference to the client?
What is the argument type of a programs main() method?
What are the different approaches to represent an inheritance hierarchy?
Difference between new operator and class.forname().newinstance()?
Is a class a subclass of itself?
What is ioc concept?
What do you mean by Socket Programming?