Janeice DelVecchio wrote:Thanks for all the replies.
I agree I only NEED one constructor and any more would be silly. I also agree that if I have the proper constructor, I wouldn't need setter methods.
I have decided to leave the class with the 2 constructors, the blank one and the one with all three. My reasoning for this is the spec asks for constructorS (plural)... and I can't think of any other ways to make a reasonable constructor with the three instance variables given. I am also leaving the setters because the spec asks for them, and it seems it is requiring me to use the setter inside the constructor. Seems backwards to me.
Hunter McMillen wrote:I'm going to disagree with Lee and say that instance variables have a lot to do with constructors. The constructor is what you should be using to initialize the instance variables of your class.
Hunter McMillen wrote: Constructors can be called with no parameters as Lee demonstrated above to create blank objects. But in the real world Most objects you create are going to have values.
Janeice DelVecchio wrote: I did compile and run before I asked. I'm just trying to figure out if the 2 constructors I made is enough to satisfy the requirements of the project spec.
Janeice DelVecchio wrote: The specification specifically states "creates all required public constructors, including one that uses all setters to initialize all private attributes"
There is no beard big enough to make me comfortable enough with my masculinity to wear pink. Tiny ad:
ScroogeXHTML - small and flexible RTF to HTML converter libraryhttps://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter