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); return (this.x == p.x && this.y == p.y);
} }
public Point clone() { @Override
return this; protected Object clone() throws CloneNotSupportedException {
return new Point(this.getX(), this.getY());
} }
public String displayLocation() { public String displayLocation() {

View File

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