Java Code:
1 2 3 4 5 6 7 8 9 10 | public class JavaVersionCheck { public static void main(String[] args) { String strJavaVersion = System.getProperty("java.specification.version"); System.out.println("Java Specification is : " + strJavaVersion); } } |
The java.lang.System.getProperties() method determines the current system properties. The current set of system properties for use by the getProperty(String) method is returned as a Properties object.