Constructor is not a regular method. It's special in a sense that it gets always called when you invoke new A()
. If you don't provide a constructor, Java creates one automatically. As a consequence, constructors do not have a return
(i.e. they return this
) and always have the same name as the class.
On the other hand, init
is a regular method, which you can call - or not. There is no universally accepted consensus for any kind of "init" methods. So it depends on what you want to do. If you want to ensure that the new
calls your logic, use constructor. If you want to have your own stuff, use plain methods. You can mix and match, just be sure to write a good documentation about how your class is supposed to be used.