I understand that it helps creates single copy of class.
I would like to know:
- What is the harm in creating multiple such instances of a class ? since garbage collection will take care of it.
- Is it that it helps when multiple classes/threads use it and Java may run out of memory ?
- It helps avoiding memory leak ?
- How to decide if singleton pattern is better for me use case ?
Or could you please lead me to resources that can be helpful to learn more about it.
Thanks