I have been reading about singleton pattern for a while now and when I searched for Singleton classes in Java language I found Runtime as an example but when I looked into the source I found very basic Singleton implementation:
private static Runtime currentRuntime = new Runtime();
public static Runtime getRuntime() {
return currentRuntime;
}
private Runtime() {}
Where as on internet there is a lot written about how a singleton class should be so basically what I wanted to know is which of the Java language class is best fit as a Singleton class example and why?
Aucun commentaire:
Enregistrer un commentaire