in Education by (55.8k points)

How can you create Singleton class in java?

1 Answer

0 votes
by (55.8k points)
How can you create Singleton class in java?
It is two step process. First, make the constructor private so that new operator cannot be used to instantiate the class. Return an object of the object if not null otherwise create the object and return the same via a method.

Related questions

0 votes
asked Mar 19 in Education by JackTerrance (1.9m points)
0 votes
asked Dec 14, 2021 in Education by JackTerrance (1.9m points)
...