Last updated 5 years ago
Was this helpful?
參考資料:()
利用token去做驗證,合法的才給資料,不合法的不給。
一個類別只有一個實體
範例:
class UnitManager { private final static UnitManager instance_ = new UnitManager(); private UnitManager() { ... } public static UnitManager getInstance() // NOT: get() or instance() or unitManager() { return instance_; } } ///:~。
*(JAVA社群常用的實踐方式,但並未一致性地被使用在JDK內,只是建議的方式。)