Answer Posted / manoj kumar
public class DateUtil implements Serializable,Cloneable {
private static volatile Dateutil instance;
private DateUtil() {
//no-op
}
public static DateUtil getInstance() {
if(instance==null) {
synchronized(DateUtil.this) {
if(instance==null) {
instance = new DateUtil();
}
}
return instance;
}
protected Object readResolve() {
return instance;
}
public Object clone() throws CloneNotSupportedException {
super.clone();
throw new CloneNotSupportedException;
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are structs in java?
What is a numeric literal?
What is function declaration?
How to implement a multithreaded applet?
Is java an open source?
What is assembly condition codes?
Explain about static nested classes in java?
What is the difference between jfc & wfc?
What is JVM and is it platform independent?
does java support pointers?
Why charat is used in java?
What is the advantage of preparedstatement over statement?
What is re-factoring in software?
what is the use of bean managed and container managed with example?
Is string a class?