There are many knowledge points in java, but some knowledge points are very important. Why do you say that? These knowledge points are very simple and basic, but when someone asks and fails to answer, they will be a rookie.
1. String immutability
There are many ways to deal with strings in Java, and string itself is a class in Java, so we can use the new method when defining a string, but there is a string constant pool for Java strings. In the Java virtual machine, the string constant pool is in the method area. After jdk1.8, it is merged with the heap. We know that the instantiated objects are stored in the heap, and the string itself is a class. It is speculated that the so-called string constant pool It also stores instance objects of string.
String s = "abcd";
s = s.concat("ef");
2. The difference between equals() method and hashCode() method
HashCode is designed to improve performance. The difference between equals() method and hashCode() method is:
-
If two objects are equal, then they must have the same hash value.
-
If the hash values of two objects are the same, they may not be equal.
3. The hierarchy of Java exception classes
There are basically two types of exception classes:
Error
Represents system and compilation errors Exception
Exception
Represents exceptions triggered by standard Java library methods
The exception of the Error class is not allowed to be caught, and the program that has the Exception exception can maintain the readability and reliability of the program through the normal operation after the capture processing.
4. The hierarchy of collection classes
Note the difference between Collections and Collection. (Collections contains a variety of static polymorphic methods related to collection operations)
5. Java synchronization
The Java synchronization mechanism can be illustrated by analogy buildings.
6. Alias
Alias means that there are multiple variables pointing to the same memory block that can be updated, and these aliases are of different object types.
7. Heap and stack
The diagram shows the location of methods and objects in memory at runtime.
8. Java virtual machine runtime data area
The diagram shows the data area when the entire virtual machine is running.
At last
I will share with you a wave of Java learning materials. These materials are all Java e-books, study notes, latest learning routes, written examination questions, interview questions, development tools, PDF documents, books and tutorials that I have compiled in the past few years when I have been working on Java. Video courses, Java job application resume templates, Java programmers face and other learning materials are free to share with you. All the materials are in my Java technology qq exchange group: 127522921, there is no routine, please download it by yourself! I bought many of them with money. Welcome everyone to join the group, you can also discuss the technology, welcome to join!