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

# Interface NameAndTypeEntry

All Superinterfaces:
  `ClassFileElementPREVIEW`, `PoolEntryPREVIEW`, `WritableElementPREVIEW<PoolEntryPREVIEW>`

public sealed interface NameAndTypeEntry extends PoolEntryPREVIEW
`NameAndTypeEntry` is a preview API of the Java platform.
Programs can only use `NameAndTypeEntry` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a `CONSTANT_NameAndType_info` constant in the constant pool of a classfile.

See Java Virtual Machine Specification:
  4.4.6 The CONSTANT_NameAndType_info Structure
Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Utf8EntryPREVIEW`
  `name()`
  Returns the field or method name.
  `Utf8EntryPREVIEW`
  `type()`
  Returns the field or method descriptor.

  ### Methods declared in interface java.lang.classfile.constantpool.PoolEntryPREVIEW

  `constantPool, index, tag, width`

  ### Methods declared in interface java.lang.classfile.WritableElementPREVIEW

  `writeTo`

- ## Method Details

  - ### name

    Utf8EntryPREVIEW name()
    Returns the field or method name.
    Returns:
      the field or method name

  - ### type

    Utf8EntryPREVIEW type()
    Returns the field or method descriptor.
    Returns:
      the field or method descriptor