I have class of multiple properties all with default values. The properties are not optional, they are required but have default values. For example:
String fillColor = "White"; String borderColor = "Blue"; int size = 10; Is it bad practice to have a single constructor and to pass in null values when default values are desired?
Object myObject = new Object(null, null, 15); Alternatively, I was thinking of possibly implementing a builder.
https://stackoverflow.com/questions/67037637/best-handling-of-constructor-with-default-values April 11, 2021 at 02:02AM
没有评论:
发表评论