I am very confusion to usage of explicit constructors in java [duplicate]

This article explains the full story. In short: you need explicit constructors if you want to pass parameters to this constructor. If you do not need this, you can either provide a “parameterless” constructor ( public Foo() {} ), or you do nothing, in which case the system will create an empty one for you in the background.

Leave a Comment