Simple Java Program to know the Java version [ 2024 ]
Simple Java Program to know the Java version
In this tutorial, we will go through the steps involved in writing a simple Java program to display the Java version in the console window. We will use the System class. This class contains useful methods for accessing environment variables, defined properties, etc.
For example:
System.getProperty() method.
This method gets the system property indicated by the specified key.
Java Code Listing
package com.testingdocs.sample.Questions; //www.TestingDocs.com public class SystemInfoDemo { public static void main(String[] args) { System.out.println("Java Version = "+ javaVersion()); } public static String javaVersion() { return System.getProperty("java.version"); } }
Run output
Java Tutorials
Java Tutorial on this website:
For more information on Java, visit the official website :