forked from hackfengJam/HelloAlgorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashCodeTest.java
More file actions
30 lines (21 loc) · 750 Bytes
/
HashCodeTest.java
File metadata and controls
30 lines (21 loc) · 750 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
package hashcode_test;
import java.util.HashMap;
import java.util.HashSet;
public class HashCodeTest {
public static void main(String[] args) {
int a = 42;
System.out.println(((Integer) a).hashCode());
int b = -42;
System.out.println(((Integer) b).hashCode());
double c = 3.1415926;
System.out.println(((Double) c).hashCode());
String d = "hackfun";
System.out.println(d.hashCode());
Student student = new Student(3, 2, "Hackfun", "jiang");
System.out.println(student.hashCode());
HashSet<Student> set = new HashSet<>();
set.add(student);
HashMap<Student, Integer> scores = new HashMap<>();
scores.put(student, 100);
}
}