Since Java 9, versioning can be aligned with Semantic Versioning. The version number can be a sequence of non-empty strings separated by dots . It contains three main parts: Major version number, Minor version number, and Security. The new version control scheme is documented in the Runtime. Version class, and version information can be accessed from it.
The version number format is as follows:
<strong>$MAJOR.$MINOR.$SECURITY(.$otherpart)?</strong>
The version string can be a version number with additional information (such as an early access release identifier or build number):
<strong>$VNUM(-$PRE)?\+$BUILD(-$OPT)? $VNUM-$PRE(-$OPT)? $VNUM(+-$OPT)?</strong>
public class VersionSchemeTest { public static void main(String args[]) { System.out.println<strong>(Runtime.version().toString()</strong>); <strong>// String representation of the version</strong> System.out.println(<strong>Runtime.version().major()</strong>); <strong>// major version number</strong> System.out.println(<strong>Runtime.version().minor()</strong>); <strong>// minor version number</strong> System.out.println(<strong>Runtime.version().security()</strong>); <strong>// security version number</strong> } }
<strong>9.0.4+11 9 0 4</strong>
The above is the detailed content of What is the new version scheme in Java 9?. For more information, please follow other related articles on the PHP Chinese website!