What is singleton class?

Answer Posted / sathya

Singleton class:
This is a class which can be instatiated only once.

Eg:

Public class Singleton
{
private static single = new Singleton();

Private Singleton();
{}
}

For a singleton class, the constructor is made private and
a static variable is used for instatiating the class.

Is This Answer Correct ?    242 Yes 44 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the Difference between Final Class && Abstract Class?

619


Which is better ascii or unicode?

577


What is the Scope of Static Variable?

734


What is the meaning of immutable regarding string?

524


List some oops concepts in java?

586






What is a copy constructor in java?

582


Why do we need wrapper class?

537


Can a singleton class be inherited?

533


What is difference between static variable and global variable?

552


Why packages are used?

548


What is externalizable?

622


What is a module function?

560


What is __ init __ functions?

553


What is a static method in java?

543


What is hashing principle in java?

555