The important thing about constructors are:
- They have to be called when creating an object
- They are only called once per object.
So
you should definitely use a constructor if:
- A value
has to be provided. You can't force someone to call a setter, but with a constructor you can force someone to pass a suitable value in.
- A value should be provided once and then never changed. For example, if you're writing an immutable class. In this case you'll have a constructor but no setter.