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 is native method in java?
What will be the default values of all the elements of an array defined as an instance variable?
What is a conditional equation?
How can you handle java exceptions?
What is the importance of hashcode() and equals() methods?
Why call by value prevents parameter value change?
Can I declare class as static or private?
Explain the difference between comparator and comparable in java?
What is jdbc api?
What are the types of java?
Is java still relevant?
What is the private method modifier?
State some situations where exceptions may arise in java?
State two differences between C and Java.
Does java list allow null?