Is Singleton class immutable?

Is Singleton class immutable?
Answer
A singleton can be mutable or immutable; a non-singleton can be mutable or immutable. … Your Student class is approximately singleton, but not immutable: any class where you have a setter method that mutates a member variable cannot be immutable.
 

Tìm kiếm

Back
Top