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

# Interface SwitchCase

public sealed interface SwitchCase
Models a single case in a `lookupswitch` or `tableswitch` instruction.

A switch case is composite:

    SwitchCase(
        int caseValue,
        Label target
    )

Since:
  24
See Also:
  - `LookupSwitchInstruction`
  - `TableSwitchInstruction`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `caseValue()`
  Returns the integer value corresponding to this case.
  `static SwitchCase`
  `of(int caseValue, Label target)`
  Returns a new switch case.
  `Label`
  `target()`
  Returns the branch target corresponding to this case.

- ## Method Details

  - ### caseValue

    int caseValue()
    Returns the integer value corresponding to this case.
    Returns:
      the integer value corresponding to this case

  - ### target

    Label target()
    Returns the branch target corresponding to this case.
    Returns:
      the branch target corresponding to this case

  - ### of

    static SwitchCase of(int caseValue, Label target)
    Returns a new switch case.
    Parameters:
      `caseValue` - the integer value for the case
      `target` - the branch target for the case
    Returns:
      a new switch case