Language Features of JAVA

review

Java has many excellent key features, including: simple, object-oriented, distributed, structure-neutral, executable, interpreted, robust, secure, high-performance, multi-threaded, and dynamic .

Simple

Java has abandoned many error-prone places in C++, such as pointers, memory management, operator overloading, and multiple inheritance.

object oriented

Java is a thorough and pure object-oriented language . In Java, "everything is an object", but Java adopts a relatively simple object-oriented technology, which removes complex concepts such as multiple inheritance and only supports single inheritance .

distributed

Java is not designed for distributed systems. J**DK (Java development kits, that is, Java development kit)** contains class libraries that support TCP/IP protocols such as HTTP and FTP. By means of a URL, a Java program can open and access objects on the network in much the same way that it accesses a local file system.

structure neutral

Java programs need to run on many different network devices with many different types of computers and operating systems. A bytecode file can run on any kind of computer that can run a Java virtual machine.

Portable

There are different versions of the Java virtual machine for different CPUs and operating systems, so that the same Java bytecode file can be ported to run on multiple different platforms.

Interpret and execute

In order to achieve cross-platform, Java is designed to be interpreted and executed, that is, Java source code files are first compiled into bytecode files, and these bytecodes themselves contain a lot of information generated at compile time. The code file is interpreted as a specific machine code for execution.

robust

The Java language is a strongly typed language . It checks the code at compile time, so that many errors can be found in the compiler, so that it will not occur at runtime and cause the system to crash.
Java abandons the pointer operation in C++ . The pointer is a powerful technology that can directly access the memory unit, but it is also very complicated. If the pointer is not manipulated properly, it will cause problems such as memory allocation errors and memory leaks. In Java, however, the problems caused by pointers do not arise.
In terms of memory management, languages ​​such as C/C++ use manual allocation and release, which often leads to memory leaks and system crashes. However, Java adopts an automatic memory garbage collection mechanism, and programmers no longer need to manage memory , thereby reducing the occurrence of memory errors and improving the robustness of the program.

Safety

During the execution of a Java program, the class loader is responsible for loading the bytecode file into the Java virtual machine. During this process, the bytecode verifier checks whether there is any illegal operation in the code. If the bytecode verifier passes the test, the Java interpreter is responsible for interpreting the bytecode into machine code for execution. This check can prevent Trojan horse viruses.

Java virtual machine

I thought about it, the virtual machine in Java is probably the same concept as the virtual machine in the group, that is, a software system (including a Java interpreter) connected between the source code and the operating system , as shown in the figure:
insert image description here
insert image description here

high performance

The Java compiler performs some optimizations on the bytecode during compilation to generate high-quality code. The Java bytecode format is designed for machine code conversion, and the actual conversion is quite simple. Java uses a kind of just-in-time compilation technology when interpreting runtime, which can greatly increase the execution speed of Java programs. Over the years of development, the Java virtual machine has also undergone many improvements, which have greatly improved the execution speed of Java programs.

Multithreading

(I have never particularly understood the meaning of multi-threaded programming. It probably means processing multiple tasks at the same time.)
Java supports multi-threaded programming. The status affects the execution of other tasks, so that real-time interactive operations on the network can be easily realized.

dynamic

When a Java program is running, various class libraries can be dynamically loaded.

Guess you like

Origin blog.csdn.net/qq_52109814/article/details/123149227