The purpose of writing this article is to summarize some of my experience in using Java over the years, mainly related to some basic Java knowledge points, so I also hope to share it with Java programmers who have just started and those who plan to enter. For those who are new to the Java development industry, I hope I can give you some experience so that you can learn and use Java better.
The main content of this introduction is related to J2SE. After so many years of Java development, and combined with some experience in interviewing Java developers, I think the main thing for J2SE is to master the following some content.
1. JVM related (including the features of each version)
For those who are new to Java, JVM related knowledge does not necessarily require a deep understanding. The concepts behind this are Just some simple understanding is enough. However, for a senior developer with more than 3 years of Java experience, it is almost unacceptable to not know the JVM.
JVM is the foundation for running Java. It is hard to believe that people who don’t know anything about JVM can understand the Java language thoroughly. When I interview developers with more than 3 years of Java experience, JVM is almost a must-ask question. Of course, JVM is not the only interview question that determines the quality of technical capabilities, but it can prove the level of Java development capabilities.
In the JVM category, I think the knowledge that needs to be mastered is:
JVM memory model and structure
GC principle, performance tuning
Tuning: Thread Dump, analysis of memory structure
class binary bytecode structure, class loader system, Class loading process, instance creation process
Method execution process: New features provided by major Java version updates (need to be briefly understood)
2. Java operation (basic Essential)
This may seem very simple. Who doesn’t know how to run a Java program? But many times, we just execute the Java program through the IDE. How does the underlying IDE execute the Java program? Many people don't understand.
This is the most basic knowledge point that Java developers need to master. When learning Java for the first time, the first step is to teach you how to execute Java programs on the command line. However, once many people have finished learning Java, IDE Once you use it, you forget about it. Why emphasize the need to know this? After knowing the purest startup method of Java, you can analyze how many directories were started at that time, how the execution naming is, what the parameters are, and whether there are any missing files when there is a startup problem. This will help you solve those weird problems that may be related to the environment during actual development.
The knowledge you need to master here is:
javac compiles java files into class files
The use of the java command, How to start the java class with package in the command line
The various paths involved in the java program (classpath, java.library.path, the main directory where java runs, etc.)
3. Data types
There is not much to say about this, it is nothing more than mastering the basic types and object types in Java. You can learn more about how JDK automatically converts, including boxing and unboxing, etc., and also pay attention to avoid judging type equality after boxing
Main knowledge points:
Basic types: int, long, float, double, boolean, . . .
Corresponding object type: Conversion of Integer and other types to basic types, boxing and unboxing
Object type: equals, hashcode
Characteristics of String type
This is a core concept of java that any java developer needs to be proficient in. Many features or knowledge points in Java are related to Java object-oriented programming concepts. In my understanding, a good developer not only needs to understand these features (knowledge points) themselves, but also needs to know how these objects are reflected in Java's object-oriented programming concepts, which is more conducive to developers mastering Java. This development language, as well as other object-oriented programming languages. Here is just a brief list. The main knowledge points include:
The three major characteristics of object-oriented: encapsulation, inheritance, polymorphism; their respective definition concepts and what characteristics are reflected , respective usage scenarios
Static multi-dispatch, dynamic single-dispatch concept
The concept and use of overloading
Inheritance: Multiple implementations of interfaces, single inheritance of base classes
Abstraction, abstract classes, interfaces
Multiple State: The concept of method coverage and the use of interface callbacks
8. Static
The main things you need to master are:
The definition and use of static attributes, and how to initialize when the class is loaded
static Definition and use of methods
Definition and use of static classes
Definition and initialization timing of static code blocks
Here are mainly some scattered Java knowledge points that are not systematically classified. It is also used a lot in daily development. There is actually a lot more to this piece of content, but I have just summarized these here temporarily:
Including: equals, hashcode, string/stringbuffer, final, finally, finalize
10. Collection Framework
This is a part that requires more mastery. When doing Java development, it can be said that there is no need to use the collection framework, which is very important. But the knowledge points here are not difficult, but it is best to understand the internal implementation of collections, because this will help you choose a suitable framework to solve problems in different scenarios. For example, a collection with 10,000 elements often requires Performing the contains judgment operation, knowing the characteristics or internal implementation of the collection, it is easy to make the right choice.
The following content is included here (concurrency related is not included):
System of the collection framework: Basic Collection, Map
Contents of specific collection implementations, specific implementations of List, Set, and Map, internal structures, special methods, applicable scenarios, etc.
Usage of collection-related tool classes Collections, etc.
Exceptions may not be taken seriously in Java development. Generally, when an exception is encountered, it can be thrown directly, or it can be handled casually and it will not have any major impact on the overall operation of the program. However, in enterprise-level design and development, the quality of exception design and handling is often related to the overall robustness of the system. For developers, the exception handling of a good system should be unified to avoid a lot of exception handling logic scattered everywhere; for the system, exceptions should be controllable and easy to operate and maintain. After certain exceptions occur, There should be ways to deal with it and know how to operate and maintain it. Therefore, although the exception framework is very simple, exception handling is very important for the entire enterprise-level application development. To handle exceptions well, you need to understand the exception system in Java.
There are not many knowledge points that need to be mastered in this part, the main ones are:
Abnormal system:
Throwable
Exception
RuntimeException
Error
RuntimeException The difference from general Exception, specific processing methods, etc.
IO is not just file reading in java Writing is so simple, and it also includes all input and output operations such as socket network reading and writing. For example, reading the content of Post in a standard HTTP request is also an output process, etc...
For IO, Java not only provides basic Input and Output related APIs, but also provides some Readers that simplify operations. , Writer and other APIs are also very important in certain developments (projects involving a large number of IO operations), and are also involved in general daily development (logs, reading and writing of temporary files, etc.).
The main knowledge points here are:
Basic IO system: including InputStream, OutputStream, Reader/Writer, file reading, various stream reading Take the concept of NIO, the specific usage and usage scenarios
13. Multi-thread concurrency
Multi-threading is generally considered a difficult area in Java. Multi-threading can effectively increase CPU usage and improve overall system efficiency, especially when a large number of IO operations are blocked; but it is also a double-edged sword. If it is not used properly, the system will not improve much, or There is no improvement, and it will also cause problems such as debugging between multi-threads.
There is a lot of content in multi-threading. I just briefly explain the knowledge points that need to be mastered for the initial use of multi-threading in Java. In the future, I will have the opportunity to introduce the usage scenarios of some advanced features in detail.
Multi-threading implementation and startup
The difference between callable and runable
syncrhoized, reentrantLock respectively Features and comparison
Thread pool
future asynchronous way to obtain execution results
##14. Network
Java also provides APIs that can directly operate the TCP protocol and UDP protocol. When network performance needs to be emphasized, TCP/UDP can be used directly for communication. By viewing the source code of Tomcat, etc., you can see the usage of these related APIs. However, TCP is generally rarely used directly, and frameworks such as MINA and Netty are used for processing. Because there is not much development in this area, I will not list it in detail.
15. Time and date processing
For almost every application, time and date processing cannot be bypassed, but the time before JDK8 is related API usage is not friendly. In those days, time frames such as Joda were available. After the release of JDK8, the new time API basically integrates the advantages of other frameworks and can be used directly.
For Java developers, they need to be proficient in using APIs to process time and date.
The specific knowledge points are no longer listed. I will write a special article in the future to summarize the usage of the time and date API in JDK8.
16.XML parsing/JSON parsing
In fact, these two pieces of content are not in J2SE, but in daily development, they interact with other programs , interacting with configuration files is increasingly inseparable from the parsing of these two formats.
However, for a developer, being able to understand some specific principles and methods of XML/JSON parsing will help you better choose a suitable method to make your program in each specific scenario. More efficient and more robust.
17. The use of Maven
Maven is not part of Java, but maven is revolutionary for java development Brings huge convenience. From the introduction and management of dependencies, to the update and release of development processes, and even version updates, using Maven can greatly simplify the complexity of the development process, thus saving a lot of time. It can be said that maven has become the standard for Java developers. Therefore, I regard maven as a necessary basic knowledge point for a java developer. In the future, I will add some of my experience and skills in using Maven, etc., so I won’t go into details here.
18. Generics
This is a new concept introduced in JDK5. It is actually a syntactic sugar. It will be somewhat convenient when writing java code. Generally For application or business development, you only need to use it simply. You may not necessarily use operations like defining generics. However, it will be used when developing some basic public components. You can take a closer look at this part when needed. Generally, as long as Just know how to use it easily.
19. The annotation
was also introduced after jdk5. Spring is an excellent framework. It uses xml as the standard configuration file from the beginning. However, after Spring 3, especially after the rise of spring-boot, the use of annotations to simplify xml configuration files has become more and more popular. For developers, it can save a lot of time in xml configuration. But the disadvantage is that the annotations are scattered in various classes. Unlike xml, all configurations can be globally understood and managed, so there is no way to completely replace all xml. For ordinary developers, it is enough to use annotations. Some publicly organized developers may need to understand the definition and implementation of annotations, and can take a closer look when needed.
20.RMI
RemoteMethodInvocation, a remote calling interface unique to the Java language, is relatively simple and convenient to use. However, if cross-language support is required, other methods such as webservice must be used to support it. Generally speaking, programs do not need to use RMI, but it can be used under specific circumstances. In a project, I used RMI to control the remote start and stop of the program.
21.JNI
Java Native Interface allows calling local interface methods in Java and is generally used for calling C/C++ code. What needs to be noted is the path problem of loading so/dll files in Java. Calling the interface itself is not complicated, but it often takes a lot of time to determine whether the required local interface library is loaded.
The above is a summary of 21 technical points and knowledge points of Java. For more related content, please pay attention to the PHP Chinese website (m.sbmmt.com)!