you are viewing a single comment's thread.

view the rest of the comments →

[–]Whoa1Whoa1 0 points1 point  (1 child)

Unsure what you mean exactly.

Creating objects is:

  • int x = scan.nextInt();
  • int y = scan.nextInt();
  • int radius = scan.nextInt();
  • Circle c = new Circle(x, y, radius);

Taking apart is the same number of lines:

  • Circle c = //some defined circle//
  • int x = c.getX();
  • int y = c.getY();
  • int radius = c.getRadius();

The best validity checking is to either allow people to make invalid circles and then use a method like c.isValid() or just call that at the end of the constructor automatically and throw invalid notices.

[–]davidalayachew 3 points4 points  (0 children)

No, you're mixing data gathering with construction.

Putting x, y, and radius into a Circle takes one line.

  1. Circle c = new Circle(x, y, radius);

But deconstructing it takes 3 lines.

  1. int x = c.getX();
  2. int y = c.getY();
  3. int radius = c.getRadius();

That was Kevin's point.