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
What happens if a try-catch-finally statement does not have a catch clause to handle an exception that is thrown within the body of the try statement?
What do you mean by flow of struts?
Discuss 2D arrays.
How to store image in arraylist in java?
How do you sort data in java?
How do I find and replace in word?
Can a constructor be private and how are this() and super() method used with constructor?
What is rmi and steps involved in developing an rmi object?
What is qms certification?
What does exclamation mean in java?
What is the Scope of Static Variable?
Why should we use singleton pattern instead of static class?
Can a static class implement an interface?
What is a variable and constant?
Does unicode support all languages?