Java two core mechanisms:
Java Virtual Machine)
Garbage Collection)
Java Virtual Machine with Core Mechanism
Java virtual machine can be understood as a CPU that uses bytecode as the machine instruction
Different virtual machines are available for different operating platforms.
The Java Virtual Machine mechanism shields the differences between the underlying platforms and achieves "one compilation and running everywhere ".
Core Mechanism-garbage collection mechanism:
Memory space that is no longer used should be recycled-junk mobile phones
In C/C ++ProgramReclaim useless memory
The Java language eliminates the programmer's responsibility to reclaim useless memory space. It provides a system-level thread to track the distribution of storage space.
Garbage collection runs automatically during Java program running, which cannot be precisely controlled by programmers.