Program to demonstrate how to know on which Java Version our current Java application is running.
Output of the program :
package com.hubberspot.java.version;
public class JavaVersion {
public static void main(String[] args) {
// In order to know which version of java
// is been used by your current application
// we can get the version of Java by
// using getProperty() method of the
// java.lang.System class and passing
// the property name as "java.version"
String javaVersion = System.getProperty("java.version");
// Printing out the Java version on the console
System.out.println("Java Version : " + javaVersion);
}
}
Output of the program :
