-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathPoint.java
More file actions
executable file
·35 lines (28 loc) · 803 Bytes
/
Point.java
File metadata and controls
executable file
·35 lines (28 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package tutorialquestions.question1ae9.original;
public class Point {
private final int coordX;
private final int coordY;
private final int coordZ;
public Point(int coordX, int coordY, int coordZ) {
this.coordX = coordX;
this.coordY = coordY;
this.coordZ = coordZ;
}
@Override
public String toString() {
return "(" + coordX + ", " + coordY + ", " + coordZ + ")";
}
@Override
public boolean equals(Object that) {
return that instanceof Point
&& coordX == ((Point) that).coordX
&& coordY == ((Point) that).coordY
&& coordZ == ((Point) that).coordZ;
}
@Override
public int hashCode() {
return Integer.valueOf(coordX).hashCode()
^ Integer.valueOf(coordY).hashCode()
^ Integer.valueOf(coordZ).hashCode();
}
}