Skip to content

Instantly share code, notes, and snippets.

@kevalpatel2106
Created November 29, 2016 09:39
Show Gist options
  • Save kevalpatel2106/5eae0f2ba32530a1ea816868e52c473e to your computer and use it in GitHub Desktop.
Save kevalpatel2106/5eae0f2ba32530a1ea816868e52c473e to your computer and use it in GitHub Desktop.
public class SingletonTester {
public static void main(String[] args) {
//Instance 1
SingletonClass instance1 = SingletonClass.getInstance();
//Instance 2
SingletonClass instance2 = SingletonClass.getInstance();
//now lets check the hash key.
System.out.println("Instance 1 hash:" + instance1.hashCode());
System.out.println("Instance 2 hash:" + instance2.hashCode());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment