Singleton mode


The main function of the Singleton pattern is to ensure that in a Java application, only one instance of a class exists.
The general form of the Singleton pattern:
define a class, its constructor is private, it has a static private variable of the class, when the class is instantiated, get a reference to it through a public getInstance method, and then call it Methods.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326995472&siteId=291194637