SOLUTION: When to specify an empty default constructor!
First of all, thank you to everybody who answered that one. I appreciate your comments.
No need for an empty default constructor (at least 80% of code)
Although some specifications require a default constructor (JavaBeans, EJB 3.0, etc.) one can go with the one created by the Java compiler. The compiler does this if no other constructor is defined. Initialisation will always take place (comments from Peter Veentjer, Frank Nimphius, Sivakiran Kolli, Joern Horstmann).Good reasons for an empty default constructor (up to 20% of code)
- To enforce that your class is non-instantiable (see Effective Java Item 2 & 3) (comments from Brian Duff, Angus Myles)
- To ensure constructor chaining to the superclass. (comment from Angus Myles)
- To have a default way for construction while other constructors are more specific (comment from Robbie Vanbrabant, Sanjay)
Personally, I don't think that always defining a default constructor is a good idea. I came across many situations where I was happy not to have a default constructor (Kevin Smeyers, sorry for objecting).