public class MySingleton implements Serializable {
static MySingleton singleton = new MySingleton();
private MySingleton() {
}
// This method is called immediately after an object of this class is deserialized.
// This method returns the singleton instance.
protected Object readResolve() {
return singleton;
}
}
e hënë, 25 qershor 2007
Abonohu te:
Posto komente (Atom)
2 komente:
here is another good link on Singleton Pattern in Java
Please see singleton pattern in java with good explanation.
Posto një koment