Java Madness Handout (3rd edition) learning notes the running mechanism of 2-java language

Source: Internet
Author: User

content

1, high-level language operation mechanism

2. Operating mechanism of Java language

1, high-level language operation mechanism

The high-level language is mainly divided into two types: compiling language and interpretive language.

A compiled language is a machine code (including machine instructions and operands) that uses a specialized compiler to "translate" high-level language source code into the platform hardware for a specific platform (operating system), and is packaged into an executable file format that the platform can recognize, which is called compilation (Compile). Compiled and generated executable programs can be run independently of the development environment and on a specific platform. Some also need to link to other compiled target code.

A compiled language is a program that requires a specialized compilation process before it executes, compiles the program into a machine-language file, does not need to be re-translated at run time, and uses the results of the compilation directly. The program executes efficiently, relies on the compiler, the cross-platform is inferior. such as C, C + +

Interpreted language is not compiled, translated into intermediate code, and then interpreted by the interpreter to run the intermediate code. The program does not need to compile, the program is translated into machine language at runtime, and is translated once per execution. Therefore, the efficiency is lower and the cross-platform is better. such as Ruby, Python

2. Operating mechanism of Java language

The Java language is special, programs written by the Java language need to be compiled, but this compilation step does not generate a platform-specific machine code, but instead generates a platform-independent bytecode (that is, the *.class file). This bytecode must be executed through the interpreter. Therefore, the execution of the Java program must be compiled first, followed by a two-step explanation, as shown in

The JVM (Java virtual Machine,java VM) is responsible for interpreting execution bytecode files (*.class files). The Java compiler is not intended for any specific platform, only for the JVM. Although the JVM is different under different platforms, they all provide the same interface to the compiler. The Java compiler generates platform-independent bytecode that cannot be run directly on different platforms and must be run through an intermediary converter (JVM).

First the Java compiler generates the code that the virtual machine understands (platform-independent bytecode files), and then the VM interprets the code to execute.

The JVM is a key part of the Java program's cross-platform, and as long as the corresponding virtual machines are implemented for different platforms, the compiled Java bytecode can be run under the platform.

The JVM is an abstract computer that, like the actual computer, has instruction sets and uses different storage areas. It is responsible for executing instructions and managing data, memory, and registers.

The Java Virtual Machine specification developed by Sun has technically defined the JVM's uniform standards, specifically defining the following details of the JVM:

    • Instruction Set
    • Register
    • class file format
    • Stack
    • Garbage collection Heap
    • Storage area

The purpose of Sun's specification is to provide a unified standard that ultimately implements the platform independence of Java programs.

Java Madness Handout (3rd edition) learning notes the running mechanism of 2-java language

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.