freeCodeCamp/guide/chinese/java/the-java-virtual-machine-jvm/index.md

13 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
title: Java Virtual Machine
localeTitle: Java虚拟机
---
# Java虚拟机JVM
Java属于称为[**Compiled Languages的**](https://en.wikipedia.org/wiki/Compiled_language)一系列[**语言**](https://en.wikipedia.org/wiki/Compiled_language) 。用这种语言编写的任何代码都需要转换编译为中间形式然后主机平台运行代码的OS /平台)可以理解这种形式。
对于Java此中间形式称为**字节码** 然后由称为Java虚拟机JVM的运行时解释。将[**JVM**](https://docs.oracle.com/javase/specs/jvms/se7/html/)视为一个能够完成运行Java代码的艰苦工作的软件。它负责内存分配线程管理垃圾收集等等。除了Java之外它还支持读取能够运行用GroovyScala等语言编写的代码。
在Java中代码被编写并保存为`.java`文件。编译器javac对java文件进行操作并生成等效的字节码 `.class` )文件。 `java`命令现在可以执行存储在`.class`文件中的字节码。稍后会详细介绍。
以下部分描述了Java中编码的一些基本构建块。