Should Java singletons use static variables?

See English answers > difference between static class and single pattern? thirty-three

Solution

You should use member variables A detail is an object (that is, an instance of a class), so it should be modeled; Even if you only intend to create one of them

Static learning should be used for class - level variables

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>