---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 19 Edition"
java_version: 19
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.ifnonnull"
heading: "ifnonnull"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se19/html/jvms-6.html#jvms-6.5.ifnonnull
id: "6.5.ifnonnull"
url: https://jvm.obfuscated.software/jvms/se19/6.5.ifnonnull.html
raw: https://jvm.obfuscated.software/jvms/se19/6.5.ifnonnull.md
---

# ifnonnull

## Operation

Branch if `reference` not `null`

## Format

```
ifnonnull
branchbyte1
branchbyte2
```

## Forms

*ifnonnull* = 199 (0xc7)

## Operand Stack

..., *value* →

...

## Description

The *value* must be of type `reference`. It is popped from the operand stack. If *value* is not `null`, the unsigned *branchbyte1* and *branchbyte2* are used to construct a signed 16-bit offset, where the offset is calculated to be (*branchbyte1* `<<` 8) | *branchbyte2*. Execution then proceeds at that offset from the address of the opcode of this *ifnonnull* instruction. The target address must be that of an opcode of an instruction within the method that contains this *ifnonnull* instruction.

Otherwise, execution proceeds at the address of the instruction following this *ifnonnull* instruction.
