Created
November 29, 2016 09:17
-
-
Save kevalpatel2106/a9bfa6002f4daea8d88a500cabd41386 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SingletonClass { | |
private static SingletonClass sSoleInstance; | |
private SingletonClass(){} //private constructor. | |
public static SingletonClass getInstance(){ | |
if (sSoleInstance == null){ //if there is no instance available... create new one | |
sSoleInstance = new SingletonClass(); | |
} | |
return sSoleInstance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment