-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
49 lines (33 loc) · 1.2 KB
/
Copy pathMain.java
File metadata and controls
49 lines (33 loc) · 1.2 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
Standards:
Strings will be created using the StringBuilder class and never as just String objects
All methods will have detailed JavaDoc comments that describes the method
Proper @Annotations will be used where needed
REQUIRED on params that cannot be null @NotNull
Unless you are printing a Strings value as is you must use the printf() function to
format all printed output.
*/
package src;
/* imports */
import src.BaseClasses.Note;
import src.Data.Note_Cache;
import static java.lang.System.out;
public class Main {
public static void main(String[] args) {
Note test_note = new Note();
Note test_two = new Note();
Note copy = test_note; // shallow same hash
Note t3 = new Note(test_note); // deep copy != same hashcode
Note_Cache cache = new Note_Cache(); // holds the notes when loaded from data
// source
cache.add_note(test_note);
cache.add_note(new Note());
out.println(cache.get_count());
test_note.setName("A random test");
test_note.display_note();
out.printf("\nthe hash of test_note: is %d\nthe hash of test_two is: %d\n",
test_note.hashCode(), test_two.hashCode());
out.println((t3.hashCode() == test_note.hashCode()) ? "Same Obj" : "Diff " +
"obj");
}
}