spooler.java
来自「设计模式是软件工程的核心思想」· Java 代码 · 共 16 行
JAVA
16 行
public class Spooler {
//this is a prototype for a printer-spooler class
//such that only one instance can ever exist
static boolean instance_flag = false; //true if one instance
public Spooler() throws SingletonException
{
if (instance_flag)
throw new SingletonException("Only one printer allowed");
else
instance_flag=true; //set flag for one instance
System.out.println("printer opened");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?