Features of the Java language
1. Object-oriented
1.1 Two basic concepts: classes, objects
1.2 Three main features: encapsulation, inheritance, polymorphism
2. Robustness
absorbs the advantages of the C + + language, but removes parts that affect program robustness (such as pointers, memory requests and releases, etc.), providing a relatively secure memory management and access mechanism
3. Cross-platform
3.1 applications written in the Java language can be run on different system platforms.
Write Once,run Anywhere
3.2 Principle: Just install a Java Virtual machine (JVM Java VM) on the operating system that needs to run the Java application. The JVM is responsible for the operation of the Java program in the system. The JVM is different in different operating systems.
Two core mechanisms of Java
1.java virtual machines (Java virtal machine)
the JVM is a virtual computer that has instruction sets and uses different storage areas. Responsible for executing instructions, managing data, memory, registers.
For different platforms, there are different virtual machines
The Java Virtual machine mechanism masks the difference between the underlying platform and implements a compilation and runs everywhere.
2. Garbage collection mechanism (garbage Collection)
memory spaces that are no longer used should be recycled-garbage collected.
In languages such as C or C + +, the program Ape is responsible for reclaiming useless memory.
Garbage collection is carried out automatically in the Java program, Cheng can not control and intervene precisely.
Java language running mechanism and running process