Home > Java > javaTutorial > body text

What is the new version scheme in Java 9?

WBOY
Release: 2023-09-13 08:05:02
forward
894 people have browsed it

Java 9中的新版本方案是什么?

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>
Copy after login
  • $MAJOR is the major version number, which is incremented when a major version is released that usually changes the platform specification. For JDK 9, the value is 9.
  • $MINOR is the minor version number used for releases that contain bug fixes and enhancements to the standard API.
  • $SECURITY is the security level used for releases that contain critical security fixes. When the minor version number is incremented, this version cannot be reset to zero.
  • $otherpart consists of one or more releases used by the JVM provider to indicate patches with minor non-security fixes.

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>
Copy after login
  • $PRE is a pre-release identifier.
  • $BUILD is the build number.
  • $OPT is optional information, such as timestamp.

Example

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>
   }
}
Copy after login

Output

<strong>9.0.4+11
9
0
4</strong>
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!