CompSci quick question

<p>Consider the following class declarations.
public class Point
{
private double x; // x-coordinate
private double y; // y-coordinate
public Point()
{
x = 0;
y = 0;
}
public Point(double a, double b)
{
x = a;
y = b;
}
// There may be instance variables, constructors, and methods that are not shown.
}
public class Circle
{
private Point center;
private double radius;
/** Constructs a circle where (a, b) is the center and r is the radius.
<em>/
public Circle(double a, double b, double r)
{
/</em> missing code <em>/
}
}
Which of the following replacements for /</em> missing code */ will correctly implement the Circle
constructor?</p>

<p>I. center = new Point();
radius = r;
II. center = new Point(a, b);
radius = r;
III. center = new Point();
center.x = a;
center.y = b;
radius = r;</p>

<p>(A) I only
(B) II only
(C) III only
(D) II and III only
(E) I, II, and III</p>

<p>Is II different from III?</p>

<p>Yes, II is different from III. III will not compile, because it illegally accesses the private class variables of Point.</p>

<p>My bad. I was remembering stuff from the API rather than reading the question. In the JAVA API, x and y are public. stupid me : P</p>

<p>Thank you.</p>