MCPcopy Create free account
hub / github.com/Anchals24/Low-Level-Design / getInstance

Method getInstance

SingletonDesignPattern/Singleton.java:14–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12 //Step3: Create a static getInstance() method to instantiate the class and also to return an instance of it.
13
14 public static Singleton getInstance(){
15 if (uniqueInstance == null){
16 uniqueInstance = new Singleton();
17 }
18 return uniqueInstance;
19 }
20
21 //other useful methods here.
22}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected