Get Java Version
Tags: System
In this Java core tutorial, we learn how to get the Java version in a Java program.
How to use System.getProperty() static method to get Java version
GetJavaVersion.java
public class GetJavaVersion {
public static void main(String[] args) {
String jdkVersion = System.getProperty("java.version");
System.out.println("Java version: " + jdkVersion);
}
}
Java version: 14.0.1
Happy Coding 😊