ClassFileVersion (Java SE 23 & JDK 23)
Description: declaration: module: java.base, package: java.lang.classfile, interface: ClassFileVersion
Keywords: java.lang.classfile.ClassFileVersion interface

# Interface ClassFileVersion

All Superinterfaces:
  `ClassElementPREVIEW`, `ClassFileElementPREVIEW`

public sealed interface ClassFileVersion extends ClassElementPREVIEW
`ClassFileVersion` is a preview API of the Java platform.
Programs can only use `ClassFileVersion` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the classfile version information for a class. Delivered as a `ClassElement`PREVIEW when traversing the elements of a `ClassModel`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `majorVersion()`
  Returns the major classfile version.
  `int`
  `minorVersion()`
  Returns the minor classfile version.
  `static ClassFileVersionPREVIEW`
  `of(int majorVersion, int minorVersion)`
  Returns a `ClassFileVersion`PREVIEW element.

- ## Method Details

  - ### majorVersion

    int majorVersion()
    Returns the major classfile version.
    Returns:
      the major classfile version

  - ### minorVersion

    int minorVersion()
    Returns the minor classfile version.
    Returns:
      the minor classfile version

  - ### of

    static ClassFileVersionPREVIEW of(int majorVersion, int minorVersion)
    Returns a `ClassFileVersion`PREVIEW element.
    Parameters:
      `majorVersion` - the major classfile version
      `minorVersion` - the minor classfile version
    Returns:
      a `ClassFileVersion`PREVIEW element