I am wondering how to program a solution, which I think is a matter of style. I need to have a single instance of a class that only has methods and attributes. To get this in java, I have two options:
- create an abstract class with static methods inside, so it will not be possible to create any instance of the class, and this is normal,
- use singleton pattern with public methods.
I tend to go for the second approach, although I met 1. What and why is better than that, or is there a third option.
source
share