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 are streams in java 8?
Why to use nested classes in java?
I want to re-reach and use an object once it has been garbage collected. Define how it’s possible?
Enlist few advantages of inheritance?
Is java developer a good career?
What are the six ways to use this keyword?
What is meant by anonymous class?
List some features of the abstract class.
I want to re-reach and use an object once it has been garbage collected. How it's possible?
What does three dots mean in java?
How to remove the trailing spaces from a string?
What are the uses of synchronized keyword?
What is unmodifiable collection in java?
Do I need java for windows 10?
Which of the following classes will have more memory allocated?