Home> Java> javaTutorial> body text

What are the different versions of the Java Virtual Machine?

WBOY
Release: 2024-04-13 11:33:01
Original
985 people have browsed it

The Java Virtual Machine (JVM) is responsible for running Java bytecode and has multiple versions. Major releases include Java 8 (introducing Lambda expressions, streams API), Java 11 (improved garbage collector), Java 14 (introducing pattern matching), and Java 17 (introducing sealed classes). In order to check the JVM version, you can use System.getProperties() to get the Java version.

What are the different versions of the Java Virtual Machine?

Different versions of Java Virtual Machine

Overview

Java Virtual Machine( JVM) is responsible for running Java bytecode, which is a key component of Java program execution. It comes in multiple versions, each offering different features and improvements.

Main Version

##Java 8 2014 Lambda expression, stream API, time and date API Java 11 2018 Local variable symbol table, garbage collector improvements, module system enhancements Java 14 2020 Pattern matching, logging, JShell improvements Java 17 2021 Sealed classes, text conversion API, Switch expression
Version Release Date Main Features

Practical case: Java version check

In order to check the JVM version running the Java program, you can use The following code:

import java.util.Properties; public class JavaVersionCheck { public static void main(String[] args) { // 获取系统属性 Properties props = System.getProperties(); // 获取 Java 版本 String javaVersion = props.getProperty("java.version"); // 打印 Java 版本 System.out.println("Java 版本:" + javaVersion); } }
Copy after login

Output:

Java 版本:11.0.13
Copy after login

This will print the JVM version of the running program.

The above is the detailed content of What are the different versions of the Java Virtual Machine?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!