About this question
Is there any purpose for declaring an init() method for a type?
I'm not asking whether we should prefer init() over a constructor or how to avoid declaring init().
I'm asking if there is any rationale behind declaring an init() method (seeing how common it is) or if it's a code smell and should be avoided.
The init() idiom is quite common, but I have yet to see any real benefit.
I'm talking about types that encourage initialization via a method:
class Demo {
public void init() {
//...
}
}
When will this ever be of use in production code?