Possible Duplicate:
Difference between static class and singleton pattern?
Which is better in Java,
implementing public static methods, like
Factory.createLoginRequest()
or implementing Singleton pattern, like
Factory.getInstance().createLoginRequest()
(Boths will return a Request object.)
Which one is better and why ?
It depends.
Choose singletons, because:
Use static methods, because:
It depends. Singleton concept considers a limitation on object initialization. In other words, singleton object must be the only instance of a singleton class in the runtime. But if you just need to create objects of some family of classes, then go with factory method pattern.
from wikipedia:
I'd go for the Singleton because it allows you to use Java's object-oriented features like inheritance (method overriding) which won't work for static methods.