Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@xiongxiao1992
Created September 28, 2013 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xiongxiao1992/6739612 to your computer and use it in GitHub Desktop.
Save xiongxiao1992/6739612 to your computer and use it in GitHub Desktop.
a java program that implements SINGLETON
class Animal{
private static Animal instance = new Animal();
private Animal(){
System.out.println("init the class");
}
public static Animal getInstance(){
return instance ;
}
public String toString(){
return "I'm an Animal, my name's qq !" ;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment