forked from liuyubobobo/Play-with-Data-Structures
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.java
35 lines (24 loc) · 902 Bytes
/
Main.java
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
import java.util.HashSet;
import java.util.HashMap;
public class Main {
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 = "imooc";
System.out.println(d.hashCode());
System.out.println(Integer.MAX_VALUE + 1);
System.out.println();
Student student = new Student(3, 2, "Bobo", "Liu");
System.out.println(student.hashCode());
HashSet<Student> set = new HashSet<>();
set.add(student);
HashMap<Student, Integer> scores = new HashMap<>();
scores.put(student, 100);
Student student2 = new Student(3, 2, "Bobo", "Liu");
System.out.println(student2.hashCode());
}
}