8 Most popular diagrams to understand Java mechanics

Source: Internet
Author: User

Original link: Top 8 diagrams for understanding Java

Translators: Anchor

Translation time: October 29, 2013

The world is always a picture more than tens of thousands of words!

The following 8 images are from the program Creek Java tutorial, which is currently the most popular article on the site.
I hope this article will help you to review the knowledge you already know. If the picture is not clear enough, you may need to read a detailed article or search.

1. properties of the string object that cannot be changed

Shows the procedure for running the following code:

1 String s = "abcd"
2 s = s.concat("ef");

Chinese reference: Java String Details

Figure 1

2. Equals () and Hashcode () method Collaboration conventions

Hashcode (hash coding, hash code) is designed to lift high performance.
The relationship between Equals () and the Hashcode () method can be summarized as:
2.1 If two objects are equal (equal), then you 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: HashMap principle of implementation

Figure 2



3. Java Exception class Hierarchy
The pink is the checked exception (checked exceptions), which must be captured by the Try{}catch statement block or declared in the method signature through the throws clause.
Another type of exception is the runtime exception (runtime exceptions), which requires the programmer to analyze the code to determine whether it is captured and processed.
When declared as error, it is a serious error and requires special handling based on business information, and error does not need to be captured.
Chinese Example: Exception

Figure 3



4. Collection Class Hierarchy Relationships
Note the difference between the collections (tool Class) and the Collection (collection top-level Interface):
Chinese Reference: Collections

Figure 4.1

Figure 4.2





5. The basic idea of the lock--java 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 refer to multiple references pointing to the same memory address (the object's actual address, which can be understood to be an object), and even the types of these references are completely different.

Figure 6



7. The memory structure of Java objects in the heap
Shows the site where methods and objects are in memory at run time
In most cases: objects (and their domains) are stored inside the heap, while the parameters of the method, local variables (references, and 6 basic types) are stored inside the stack.
Of course, in very special cases (extreme optimizations [object stack], constant pool [String], static variable [method area], etc.) will also break this unspoken rule.

Figure 7



8. JVM Runtime Data area
Shows the data partitioning of the JVM (Java Virtual machine) runtime population

Figure 8



Related articles:
1. Contains () method for set in Java

2. Equals () and Hashcode () method Collaboration conventions

3. Java object Reference Processing mechanism

4. HashMap vs. TreeMap vs. Hashtable vs. Linkedhashmap

8 Most popular diagrams to understand Java mechanics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.