fix clone @overrired
This commit is contained in:
parent
dab87d0c0c
commit
bc8f587661
@ -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() {
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user