1. Immutable attributes of a string object
The following illustration shows the procedure for running this code:
[Java] view plain copy String s = "ABCD"; s = S.concat ("EF"); Chinese reference: Java String Detailed
Figure 1
2. Equals () and Hashcode () method Collaboration Conventions
Hashcode (hash code, hash code) is designed to raise performance.
The relationship between Equals () and the Hashcode () method can be summarized as:
2.1 If two objects equal (equal), then must have the same hash code (hash code)
2.2 Even if two objects have the same hash value (hash code), they are not necessarily equal.
Chinese reference: The realization principle of HashMap
Figure 2
3. Java Exception class hierarchy
Pink is a checked exception (checked exceptions) that must be captured by a Try{}catch statement block, or declared by a throws clause in the method signature.
Another type of exception is the Run-time exception (runtime exceptions), which requires the programmer to analyze the code to determine whether it is captured and processed.
and declared as error, it is a serious error, the need for special treatment based on business information, error does not need to capture.
Chinese Example: Exception
Figure 3
4. Collection class hierarchy structure relationship
Note the difference between collections (tool Class) and Collection (set top interface):
Chinese Reference: Collections
Figure 4.1
Figure 4.2
5. Lock--java The basic idea of synchronization
The Java Synchronization (synchronization) mechanism can be likened to a building:
Chinese reference: Thread synchronization---Synchronized
Figure 5
6.Java object reference Processing mechanism
Aliases are multiple references that point to the same memory address (the object's actual address, which is understood to be an object), and even the types of references are completely different.
Figure 6
7. The memory structure of Java objects in the heap
The following figure shows the site of the method and object in the Run-time memory
In most cases, objects (and their property fields) are stored in the heap, and the parameters of the method, local variables (references, and 6 basic types) are stored in the stack.
Of course, very special circumstances (extremely optimized [object stack], constant pool [String], static variable [method area], etc.) will also break this unspoken rule.
Figure 7
8. JVM Runtime Data area
The following illustration shows the data region partitioning of the JVM (Java Virtual machine) runtime population
Figure 8
Original link: https://www.programcreek.com/2013/09/top-8-diagrams-for-understanding-java/
Translation: http://www.importnew.com/11725.html