What is singleton class?

Answer Posted / vimal eldose george

Singleton gives only one instance.

class Single{

static int objCreated = 0;
private Single(){
}
public static Single getThis(){
if(objCreated==0)
{
return new Single();
ob=1;
}else
{
return this;
}
}

}

Is This Answer Correct ?    32 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between process and thread?

595


What is the byte order of byte buffer?

555


What is integer size in java?

499


What is a “stateless” protocol ?

547


Name some OOPS Concepts in Java?

631






Does string is thread-safe in java?

582


What about main() method in java ?

560


Difference between method overloading and overriding.

573


Is empty .java file name a valid source file name?

579


Differentiate between overriding and overloading cases?

586


Why a dead thread occurs?

566


What does exclamation mean in java?

563


What does the “final” keyword mean in front of a variable? A method? A class?

540


What is the structure of java?

500


Which is dependent variable?

481