0 votes
21 views
in Education by (51.6k points)

How can you create Singleton class in java?

1 Answer

0 votes
by (51.6k 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
1 answer 38 views
0 votes
1 answer 26 views
0 votes
1 answer 18 views
0 votes
1 answer 14 views
0 votes
1 answer 25 views
0 votes
1 answer 24 views
0 votes
1 answer 15 views
...