Can an observable class be constructed as a singleton?

前端 未结 3 1796
悲&欢浪女
悲&欢浪女 2021-01-28 17:13

I\'m making a program in Java with the Observer pattern (with the help of the Java API). If some of the observables had more than one instance, the program could crash. Should I

3条回答
  •  旧时难觅i
    2021-01-28 17:49

    I did it before and didn't have any problems exactly because I used a singleton. The pattern is there to use it.

提交回复
热议问题