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

# Interface ThrowInstruction

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `InstructionPREVIEW`

public sealed interface ThrowInstruction extends InstructionPREVIEW
`ThrowInstruction` is a preview API of the Java platform.
Programs can only use `ThrowInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models an `athrow` instruction in the `code` array of a `Code` attribute. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Method Summary

  Static Methods
  Modifier and Type
  Method
  Description
  `static ThrowInstructionPREVIEW`
  `of()`
  Returns a throw instruction.

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

  `opcode, sizeInBytes`

- ## Method Details

  - ### of

    static ThrowInstructionPREVIEW of()
    Returns a throw instruction.
    Returns:
      a throw instruction