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
Explain working of call by reference function invoking.
What is java life cycle?
How is the marker interface used in Java?
how to run ecllipse with jettyserver for windows environment using batch file
Why are the destructors for base class and derived class called in reverse order when the program exits
What is assembly used for?
What is a void method?
What is the full meaning of java?
What is the purpose of garbage collection in java?
what do you mean by classloader?
What does index mean in java?
Can a string be null?
How do you escape sequences in java?
What is a parameter in matrices?
Do we have pointers in java?