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
how come we know the object is no more used in the class?
How to avoid memory leak in java?
What is primitive array?
What is instance synchronization?
Why stringbuilder is not thread safe?
What is the exact difference in between Unicast and Multicast object? Where will it be used?
Which is better list or arraylist in java?
What is stringjoiner ?
How do you use nextline in java?
How do you find the maximum number from an array without comparing and sorting?
What is set string?
How are the elements of a gridbaglayout organized in java programming?
What is parse method?
What is use of inner class in java?
Name container classes in java programming?