Java SE API

Runtime.version

Read the running Java version.

Formal Syntax & Structure

java syntaxjava
Runtime.version()

Working Example

Example Snippetjava
public class Main {
    public static void main(String[] args) throws Exception {        System.out.println(Runtime.version().feature() >= 21);        System.out.println(!System.getProperty("java.vendor").isBlank());    }}
Java Reference