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

What are the different methods of identifying an object?

573


How are the elements of a cardlayout organized?

595


What is permgen or permanent generation?

581


What are the difference between RMI and CORBA?

619


Explain ioc concept?

621






What is a sessionfactory? Is it a thread-safe object?

677


Will the general public have access to the infobus apis?

527


What is a clone?

572


What is the difference between session and entity beans?

578


Can I run seam outside of jboss as?

638


what are the advantages of JTA over JTS?

1667


What is bean? Where can it be used?

575


What are the sequence of steps to write pub or sub model kind of application?

1892


What is the difference between system.out ,system.err and system.in?

594


what is a non-repeatable read?

1826