public class Runtime {
private static Runtime currentRuntime = new Runtime();
public static Runtime getRuntime() {
return currentRuntime;
}
private Runtime() { }
}
这是典型的饿汉模式。懒汉和饿汉各有应用场景,请看文章:http://blog.csdn.net/woshixuye/article/details/10020709?locationNum=2
时间: 2024-09-27 02:52:20