Skip to content

Instantly share code, notes, and snippets.

@kevalpatel2106
Created November 29, 2016 09:17
Show Gist options
  • Save kevalpatel2106/a9bfa6002f4daea8d88a500cabd41386 to your computer and use it in GitHub Desktop.
Save kevalpatel2106/a9bfa6002f4daea8d88a500cabd41386 to your computer and use it in GitHub Desktop.
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