Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132930 views
License: OTHER
1
public class Country {
2
int population;
3
double area;
4
String name;
5
6
7
@Override
8
public int hashCode() {
9
return 0;
10
}
11
12
@Override
13
public boolean equals(Object obj) {
14
if (this == obj)
15
return true;
16
if (obj == null)
17
return false;
18
if (getClass() != obj.getClass())
19
return false;
20
Country other = (Country) obj;
21
if (Double.doubleToLongBits(area) != Double
22
.doubleToLongBits(other.area))
23
return false;
24
if (name == null) {
25
if (other.name != null)
26
return false;
27
} else if (!name.equals(other.name))
28
return false;
29
if (population != other.population)
30
return false;
31
return true;
32
}
33
}
34
35