0
到目前为止,我有这在我的Point类(JAVA)无法设置X和Y点
//Data
private int x;
private int y;
//Default Constructor
public Point ()
{
this.x = 0;
this.y = 0;
}
//Parameterized Constructor.
public Point (int newX , int newY)
{
this.x = newX;
this.y = newY;
}
//Copy Constructor.
public Point (Point other)
{
this.x = other.x;
this.y = other.y;
}
我试图创建另一个类叫做段将用我的Point类,并在该类我有这
private Point Point1;
private Point Point2;
public Segment ()
{
this.Point1 = (0, 0);
this.Point2 = (7, 7);
}
但是,我收到一个错误,说它期望在每个X和Y点之间的“)”权利。
为什么我得到那个错误?在我的课堂上,我已经设置了它,以便接受一个新的X和Y,并将它们设置为新的点。所以在我的课堂课上,我传递了一个X和Y.
请帮助我或澄清我做错了什么。谢谢。
能否请您,为什么我需要重点工作的新解释一下吗? – Paincakes
因为你正在制作一个新的Point对象 –
好吧,我明白了。谢谢。 – Paincakes