Constructor combinations or null parameters?

Hi guys,What is considered the better practice - having many constructor combinations (of parameters) , or having only a few constructor overloads with parameters which are allowed to be null ? Thanks.Regards,Angel
[242 byte] By [atodorova] at [2007-11-27 5:37:56]
# 1

I guess it depends on the Object, you must have some idea how many values should be available most/all of the time, and how many values will be initialized later on. Are some of the null values ever going to be used? if not then maybe your class should have a super type which is more basic, with less variables. You shouldn't be carrying around nulls that will never have values.

It is common in the API to have 2-3 constructors and a no-args one. Usually though if you call a constructor with fewer args default values are given to the other variables not included in the parameter list.

Maybe other have other opinions on this.

_helloWorld_a at 2007-7-12 15:10:47 > top of Java-index,Java Essentials,Java Programming...