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

# new

## Operation

Create new object

## Format

```
new
indexbyte1
indexbyte2
```

## Forms

*new* = 187 (0xbb)

## Operand Stack

... →

..., *objectref*

## Description

The unsigned *indexbyte1* and *indexbyte2* are used to construct an index into the run-time constant pool of the current class ([§2.6](2.6.md)), where the value of the index is (*indexbyte1* `<<` 8) | *indexbyte2*. The run-time constant pool entry at the index must be a symbolic reference to a class or interface type. The named class or interface type is resolved ([§5.4.3.1](5.4.3.1.md)) and should result in a class type. Memory for a new instance of that class is allocated from the garbage-collected heap, and the instance variables of the new object are initialized to their default initial values ([§2.3](2.3.md), [§2.4](2.4.md)). The *objectref*, a `reference` to the instance, is pushed onto the operand stack.

On successful resolution of the class, it is initialized if it has not already been initialized ([§5.5](5.5.md)).

## Linking Exceptions

During resolution of the symbolic reference to the class or interface type, any of the exceptions documented in [§5.4.3.1](5.4.3.1.md) can be thrown.

Otherwise, if the symbolic reference to the class or interface type resolves to an interface or an `abstract` class, *new* throws an `InstantiationError`.

## Run-time Exception

Otherwise, if execution of this *new* instruction causes initialization of the referenced class, *new* may throw an `Error` as detailed in JLS §15.9.4.

## Notes

The *new* instruction does not completely create a new instance; instance creation is not completed until an instance initialization method ([§2.9.1](2.9.1.md)) has been invoked on the uninitialized instance.
