anonymous
  • anonymous
Can someone explain to me what the difference between a setter and constructor is? and If this code looks right? public class Square { // private instance veriable private double length; // constructor public Square(double l) { length = l; } // setter public void setLength(double length) { this.length = length; }
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
e.mccormick
  • e.mccormick
A constructor has the same name as the class and builds things as soon as the class is turned into an object. A setter allows access to the private internals of an object. I saw a great example recently, let me see if I can find/remember where. I think I know, and if I am right, it will show how they are different, but a constructor can use a setter!
e.mccormick
  • e.mccormick
This is an example with Java, but it shows how overloaded constructors work. The constrictors are linked to a setter. The rules are similar no matter what the language. The specifics of how to build a constructor are all that really change. Do you use __SELF__ and so on.... http://thenewboston.org/watch.php?cat=31&number=39

Looking for something else?

Not the answer you are looking for? Search for more explanations.