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

# invokestatic

## Operation

Invoke a class (`static`) method

## Format

```
invokestatic
indexbyte1
indexbyte2
```

## Forms

*invokestatic* = 184 (0xb8)

## Operand Stack

..., [*arg1*, [*arg2* ...]] →

...

## 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 method or an interface method ([§5.1](5.1.md)), which gives the name and descriptor ([§4.3.3](4.3.3.md)) of the method or interface method as well as a symbolic reference to the class or interface in which the method or interface method is to be found. The named method is resolved ([§5.4.3.3](5.4.3.3.md), [§5.4.3.4](5.4.3.4.md)).

The resolved method must not be an instance initialization method, or the class or interface initialization method ([§2.9.1](2.9.1.md), [§2.9.2](2.9.2.md)).

The resolved method must be `static`, and therefore cannot be `abstract`.

On successful resolution of the method, the class or interface that declared the resolved method is initialized if that class or interface has not already been initialized ([§5.5](5.5.md)).

The operand stack must contain *nargs* argument values, where the number, type, and order of the values must be consistent with the descriptor of the resolved method.

If the method is `synchronized`, the monitor associated with the resolved `Class` object is entered or reentered as if by execution of a *monitorenter* instruction ([§*monitorenter*](6.5.monitorenter.md)) in the current thread.

If the method is not `native`, the *nargs* argument values are popped from the operand stack. A new frame is created on the Java Virtual Machine stack for the method being invoked. The *nargs* argument values are consecutively made the values of local variables of the new frame, with *arg1* in local variable 0 (or, if *arg1* is of type `long` or `double`, in local variables 0 and 1) and so on. Any argument value that is of a floating-point type undergoes value set conversion ([§2.8.3](2.8.3.md)) prior to being stored in a local variable. The new frame is then made current, and the Java Virtual Machine `pc` is set to the opcode of the first instruction of the method to be invoked. Execution continues with the first instruction of the method.

If the method is `native` and the platform-dependent code that implements it has not yet been bound ([§5.6](5.6.md)) into the Java Virtual Machine, that is done. The *nargs* argument values are popped from the operand stack and are passed as parameters to the code that implements the method. Any argument value that is of a floating-point type undergoes value set conversion ([§2.8.3](2.8.3.md)) prior to being passed as a parameter. The parameters are passed and the code is invoked in an implementation-dependent manner. When the platform-dependent code returns, the following take place:

- If the `native` method is `synchronized`, the monitor associated with the resolved `Class` object is updated and possibly exited as if by execution of a *monitorexit* instruction ([§*monitorexit*](6.5.monitorexit.md)) in the current thread.
- If the `native` method returns a value, the return value of the platform-dependent code is converted in an implementation-dependent way to the return type of the `native` method and pushed onto the operand stack.

## Linking Exceptions

During resolution of the symbolic reference to the method, any of the exceptions pertaining to method resolution ([§5.4.3.3](5.4.3.3.md)) can be thrown.

Otherwise, if the resolved method is an instance method, the *invokestatic* instruction throws an `IncompatibleClassChangeError`.

## Run-time Exceptions

Otherwise, if execution of this *invokestatic* instruction causes initialization of the referenced class or interface, *invokestatic* may throw an `Error` as detailed in [§5.5](5.5.md).

Otherwise, if the resolved method is `native` and the code that implements the method cannot be bound, *invokestatic* throws an `UnsatisfiedLinkError`.

## Notes

The *nargs* argument values are not one-to-one with the first *nargs* local variables. Argument values of types `long` and `double` must be stored in two consecutive local variables, thus more than *nargs* local variables may be required to pass *nargs* argument values to the invoked method.
