The purpose of writing this article is to summarize my experience in using Java for so many years, mainly related to some Basic Knowledge points of Java, so I also hope to share it with the Java programmers who have just started and the would-be novices who plan to enter the Java development industry, hoping to give you some experience. Make it easier for you to learn and use Java.
The main content of this presentation is j2SE-related, in addition, some J2Ee-related and Java frameworks will be introduced in the future.
After so many years of Java development, combined with the usual interview Java developers experience, I think J2SE is mainly to master some of the following content.
1. Jvm-related (including features of each version)
For those new to Java, knowledge of the JVM does not have to be deep, but a brief understanding of the concepts involved. However, for an experienced developer with more than 3 years of Java experience, not knowing the JVM is almost unacceptable.
The JVM is the foundation on which Java runs, and it’s hard to believe that someone who doesn’t know anything about the JVM can know everything about the Java language. When I interview developers with more than 3 years of Java experience, the JVM is almost a must-ask question. Of course, the JVM is not the only interview question that determines technical competence, but it is a good example of Java development competence.
In the JVM category, I think the things to know are:
JVM memory model and structure
GC principle, performance tuning
Tuning: Thread Dump, analyzing memory structure
Class binary bytecode structure, class loader system, class loading process, instance creation process
Method execution process
New features provided by major Java releases (basic knowledge required)
2. Java running (Basic requirements)
This one may seem simple, but who doesn’t run Java programs? But most of the time, we just use the IDE to execute Java programs. How does the underlying IDE execute Java programs? Many people don’t.
This is one of the most basic things Java developers need to know. The first thing you learn is how to execute Java programs on the command line, but many people forget this once they learn Java and use the IDE. Why do you want to know this? Knowing the purest way to start Java allows you to analyze how many directories you started, how the execution was named, what the parameters were, whether there were any missing files, etc. This allows you to really develop solutions to all the weird and potentially environment-related problems.
The knowledge to master here includes:
Javac compiles Java files to class files
The use of Java commands, where a Java class with package is launched on the command line
The various paths involved in Java programs (classpath, Java). The library. Path, home directory where Java runs, etc.)
3. Data types
There’s not much to say about this, but it’s all about basic types and object types in Java. Learn more about automatic conversion in the JDK, including boxing and unboxing, etc., but also pay attention to avoid boxing type equality judgment
Key points:
Basic types: int, long, float, double, Boolean…
Corresponding object types: Integer and other types of conversion to basic types, boxing and unboxing
Object type: equals, hashcode
Characteristics of the String type
4. Objects and instances, object creation
In this regard, developers need to understand the concepts and differences between class and Instance, which is a foundation of Java’s object-oriented nature. The main points are:
Class and Instance concepts
Instance creation process:
1. No inheritance: allocate memory, initialize variables, call constructors
2. There is inheritance: handling static actions, allocating memory space, defining variables as initializers, handling initialization at definitions from base -> subclasses, performing constructors
Points to note:
Static properties and so on are initialized from base -> subclasses
Properties associated with the default no-argument constructor
5. Access control
This is also a foundation of Java encapsulation features, to master:
Public protected default private Modifiers for class, method, field
6. Process control
The basics of Java process control, although some of the syntax may not be very common, need to be understood and used where appropriate.
To master are:
Syntax for flow control such as if, switch, loop, for, while
7. The concept of object-oriented programming
This is a core Java concept that should be mastered by any Java developer. Many of the features or knowledge points in Java are related to Java object-oriented programming concepts. In my opinion, a good developer not only needs to understand the features themselves, but also needs to know how these objects are reflected in the concept of Java object-oriented programming, which is more conducive to the developer to master the Java development language, as well as other object-oriented programming languages. Here is just a brief list, the main knowledge points include:
Object-oriented three features: encapsulation, inheritance, polymorphism; Their definition of the concept, what features are reflected, their use scenarios
Static multiple dispatch, dynamic single dispatch concept
The concept and use of overloading
Inheritance: Multiple interface implementations, single base class inheritance
Abstract, abstract class, interface
Polymorphism: the concept and use of method coverage
The callback interface
8. Static
Static properties are also frequently used in Java daily development. You need to understand the usage of the static keyword, as well as the use of other keywords, such as whether it can be used together with the keywords such as abstract and final.
The main things to master are:
How static attributes are defined, used, and initialized during class loading
Definition and use of static methods
Definition and use of static classes
Static code block definition and initialization timing
9. Basics
Here mainly lists some scattered, no system classification of some Java knowledge points. It is also used in daily development. In fact, there are a lot of this content, just temporarily summarized these several here:
Include:
Equals, HashCode, String/StringBuffer, Final, finally, Finalize
10. Collection framework
This is an area that needs to be mastered. It is important to do Java development without using a collection framework. But the knowledge is not difficult, but to set the best to understand the internal implementation approach, because it can help you in each different scenario to choose a suitable framework to solve the problem, such as the 1 w a collection of elements, often should undertake the contains operation, know the characteristics of the collection or internal implementation, it is easy to make the right choice.
This includes the following (concurrency is not included) :
Collection framework system: basic Collection, Map
Specific Set implementation content, List, Set, Map specific implementation, internal structure, special methods, applicable scenarios, etc
The use of the collections-related utility classes, Collections, etc
11. Exception framework
Exceptions may not be as important in Java development. In general, there is no great impact on the overall operation of the program after directly throwing or catching exceptions. However, in enterprise design and development, the design and handling of exceptions are often related to the robustness of the system as a whole. A good system exception handling for the developer should be uniform, avoid scattered exception handling logic; For system, the anomaly should be controlled, and is easy to operations, some abnormal, there should be a response to approach, know how to operational process, so although exception framework is very simple, but for the entire enterprise application development, exception handling is important to deal with abnormal you need to understand the exception system of Java.
There are not many knowledge points to master in this part, mainly including:
Abnormal system:
Throwable
Exception
RuntimeException
Error
Copy the code
A RuntimeException is a common Exception
12.Java IO
IO in Java is not only file read and write so simple, but also includes socket network read and write and so on all input and output operations. For example, reading the content of a Post in a standard HTTP request is an output process, etc…
For IO, Java not only provides basic Input and Output related apis, but also provides some simplified operation apis such as Reader and Writer. It is also important in some development projects (involving a large number of I/O operations), and is also involved in daily development (logging, reading and writing temporary files, etc.).
The main knowledge points in this are:
Basic IO system: including InputStream, OutputStream, Reader/Writer, file reading, various streams reading and so on
The concept of NIO, specific usage and usage scenarios
13. Multi-threaded concurrency
Multithreading is generally considered a difficult part of Java. Multithreading can effectively improve THE CPU utilization rate, improve the overall system efficiency, especially in the case of a large number of IO operation blocking; But it is also a double-edged sword, if the use is not good, the system not only improve little, or no improvement, but also bring debugging problems between multiple threads.
There are a lot of content in multi-threading, just a brief description of the initial use of multi-threading in Java to master the knowledge, later have the opportunity to separate and detailed some advanced features of the use of the scenario.
Multithreading implementation and startup
Callable is different from runable
Characteristics and comparison of syncrhoized and reentrantLock
The thread pool
Future gets the execution result asynchronously
Concurrent package
lock
14. The network
Java also provides apis for directly operating TCP and UDP protocols. In cases where network performance needs to be emphasized, TCP/UDP can be directly used for communication. You can see the usage of these apis in the source code of Tomcat, etc. However, TCP is seldom used directly, and frameworks such as MINA and Netty are used for processing. As there is not much development involved in this area, I will not list in detail.
15. Time and date processing
Time and date handling is also tricky for almost every application, but the time related apis prior to JDK8 were not user-friendly. In that era, time frames such as Joda were available. By the time JDK8 was released, the new time-based API basically incorporated the benefits of the other frameworks and was ready to be used directly.
For Java developers, you need to be proficient in using the API to manipulate times and dates.
I will write a later article summarizing the use of the date and time API in JDK8.
XML parsing/JSON parsing
In fact, these two contents are not J2SE inside the content, but in daily development, and other programs interaction, and configuration file interaction, more and more inseparable from these two formats of parsing.
However, as a developer, understanding the principles and methods of XML/JSON parsing can help you choose the right way to make your application more efficient and robust in each specific scenario.
XML: You need to understand the basic principles of DOM parsing and SAX parsing and their applicable scenarios
JSON: You need to understand some common JSON frameworks such as Jackson, FastJson, Gson, etc.
17. The use of Maven
Maven is not in Java either, but Maven is revolutionary and brings great convenience to Java development. From the introduction and management of dependencies, to the updating of development processes and release outputs, to the updating of versions, using Maven can greatly simplify the complexity of the development process, resulting in significant time savings. Maven has become standard for Java developers. So I use Maven as a basic knowledge base for Java developers. In the future, I will cover some of my experiences and tips on using Maven, but I won’t go into details here.
18. Generics
This is JDK5 started to introduce new concept, is actually a syntactic sugar, there’s a convenience when writing Java code, general application or the development of the business, only need a simple to use, does not necessarily need to define a generic such operations, but the development, some basic common components will have access to this part can be in need of looking closer, In general, as long as you can use it simply.
19. Mark
Also introduced after JDK5. Spring is an excellent framework that starts with XML as the standard configuration file. However, with Spring3, and especially with the advent of Spring-Boot, annotations are becoming increasingly popular to simplify XML configuration files, which can save developers a lot of time in XML configuration. But the disadvantage is that annotations are scattered across classes, unlike XML, which has a global understanding and management of all configurations, so there is no way to completely replace XML. For the average developer, it’s ok to use annotations, but some publicly built developers may need to understand the definition and implementation of annotations, so they can review them as needed.
20.RMI
The Remote Invocation of the Java language is simple to use. However, in the case of cross-language support, other means such as WebService are needed. In general, applications do not need to use RMI, but they can be used in certain situations, such as in one project where I used RMI to remotely start and stop applications.
21.JNI
Java Native Interface allows you to call Native Interface methods in Java. It is generally used to call C/C++ code. One thing to note is the path to load so/ DLL files in Java. Calling the interface itself is not complicated, but it often takes a lot of time to determine whether or not the required local interface library is loaded.
The above is just a brief introduction of my views and introduction to the basic Knowledge and technical points of Java. These contents are derived from my summary of using Java over the years. I hope to give some experience to those who are new to Java, or who are planning to develop from Java, and hope to learn and use Java more efficiently. Avoid detours and waste valuable time. There are still some incomplete parts, which will be added in future articles. Due to my limited personal ability, of course, there will be some mistakes and omissions, welcome to correct, discuss together, and improve this article together, hoping that it can really help people in need.