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


Please Help Members By Posting Answers For Below Questions

how to make a index.jsp for running the site in internet and find an error for connection with weblogic server and java that give an error invalid object name.and how to maintain session.

1751


What is difference between object state and behavior?

581


What is permgen or permanent generation?

585


What is the form of storage space in java?

1740


What is an abstract method?

593






Explain what is orm?

680


How to implement RMI in Java?

2403


Why do threads block on i/o?

683


What is aop(assepct oriented programing)?

581


What is table mutation and how do you avoid it?

1918


How messaging services are done, before release of JMS?

1588


In inglish: How to convert jar to exe files? Em português: Como converter arquivos .jar para .exe?

2158


How to determine SGA site?

1909


how to use debug in my elipse to solve problems that exist in my project

1765


cud u help me ... i am struggling with this question... to find all the subsets of a given set for ex.... a,,b,c shud give all the subsets.... i gt the program in c bt nt able to get it in java..... help needed ..

1736