fix clone @overrired

This commit is contained in:
JunkJumper 2020-05-24 19:15:12 +02:00
parent dab87d0c0c
commit bc8f587661
2 changed files with 5 additions and 4 deletions

View File

@ -52,8 +52,9 @@ public class Point
return (this.x == p.x && this.y == p.y);
}
public Point clone() {
return this;
@Override
protected Object clone() throws CloneNotSupportedException {
return new Point(this.getX(), this.getY());
}
public String displayLocation() {

View File

@ -32,8 +32,8 @@ public class TestPoint {
}
@Test
public void testClone() {
pT = p1.clone();
public void testClone() throws CloneNotSupportedException {
pT = (Point) p1.clone();
assertTrue(pT.equals(p1));
}