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

# Interface Instruction

All Superinterfaces:
  `ClassFileElement, CodeElement`

All Known Subinterfaces:
  `ArrayLoadInstruction, ArrayStoreInstruction, BranchInstruction, ConstantInstruction, ConstantInstruction.ArgumentConstantInstruction, ConstantInstruction.IntrinsicConstantInstruction, ConstantInstruction.LoadConstantInstruction, ConvertInstruction, DiscontinuedInstruction, DiscontinuedInstruction.JsrInstruction, DiscontinuedInstruction.RetInstruction, FieldInstruction, IncrementInstruction, InvokeDynamicInstruction, InvokeInstruction, LoadInstruction, LookupSwitchInstruction, MonitorInstruction, NewMultiArrayInstruction, NewObjectInstruction, NewPrimitiveArrayInstruction, NewReferenceArrayInstruction, NopInstruction, OperatorInstruction, ReturnInstruction, StackInstruction, StoreInstruction, TableSwitchInstruction, ThrowInstruction, TypeCheckInstruction`

public sealed interface Instruction extends CodeElement permits ArrayLoadInstruction, ArrayStoreInstruction, BranchInstruction, ConstantInstruction, ConvertInstruction, DiscontinuedInstruction, FieldInstruction, InvokeDynamicInstruction, InvokeInstruction, LoadInstruction, StoreInstruction, IncrementInstruction, LookupSwitchInstruction, MonitorInstruction, NewMultiArrayInstruction, NewObjectInstruction, NewPrimitiveArrayInstruction, NewReferenceArrayInstruction, NopInstruction, OperatorInstruction, ReturnInstruction, StackInstruction, TableSwitchInstruction, ThrowInstruction, TypeCheckInstruction (not exhaustive)
Models an executable instruction in the `code` array of the `Code` attribute of a method. The order of instructions in a `CodeModel` is significant.

The `opcode` identifies the operation of an instruction. Each kind of opcode has its own modeling interface for instructions.

See Java Virtual Machine Specification:
  6.5 Instructions
Sealed Class Hierarchy Graph:
Since:
  24
See Also:
  - `Opcode`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Opcode`
  `opcode()`
  Returns the operation of this instruction.
  `int`
  `sizeInBytes()`
  Returns the size in bytes of this instruction.

- ## Method Details

  - ### opcode

    Opcode opcode()
    Returns the operation of this instruction.
    Returns:
      the operation of this instruction

  - ### sizeInBytes

    int sizeInBytes()
    Returns the size in bytes of this instruction. This value is equal to `opcode().sizeIfFixed()` if it is not `-1`.
    Returns:
      the size in bytes of this instruction