Java Interview question -2
Question 11: How to restrict object creation in Java?
We can simply use a singleton design pattern to do that. here are quick steps to do that —
Private constructor to restrict instantiation of the class from other classes.
The private static varia...
tusharkant.hashnode.dev6 min read