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);
|
||||
}
|
||||
|
||||
public Point clone() {
|
||||
return this;
|
||||
@Override
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
return new Point(this.getX(), this.getY());
|
||||
}
|
||||
|
||||
public String displayLocation() {
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user