As far my understanding goes while using the factory method we used to get the object by calling a static method of the factory .. like Foo f = Factory.getObj()
.. the method is made static as we do not need to create an object before calling the getObj
method which will actually return my desired concrete object. But why it is not common to create an instance of the Factory
class using new Factory()
and then calling the req getObj method?
Sorry if this sound foolish but why it is common to make the factory method as static?
Also is static factory and factory are two different thing?