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

What is the difference between ArrayList and Vector? which one is better in Java

865


What is module in oop?

804


What are the data types supported by java?

789


What is downcasting?

821


What are untrusted applets?

868


Can we assign the reference to this variable?

757


What is the difference between object oriented programming language and object based programming language?

796


Does list maintain insertion order java?

732


Can we override constructor?

812


Write a program to print fibonacci series up to count 10.

720


What are some examples of variable costs?

743


What is difference between stringbuffer and string?

763


What is use of arraylist in java?

874


What is a ?

994


Why stringbuilder is not thread safe?

801