18 lines
401 B
Java
Executable File
18 lines
401 B
Java
Executable File
package com.zeekling.simgleton;
|
|
|
|
/**
|
|
* Created by lzh on 3/30/16.
|
|
*/
|
|
public class HungrySingleton {
|
|
private static final HungrySingleton HUNGRY_SIMGLETON = new HungrySingleton();
|
|
private HungrySingleton(){
|
|
|
|
}
|
|
public static HungrySingleton getInstance(){
|
|
return HungrySingleton.HUNGRY_SIMGLETON;
|
|
}
|
|
public void say(){
|
|
System.out.println("I am hungry");
|
|
}
|
|
}
|