Contents | Prev | Next | Index

putstatic

The constant pool item is resolved (§5.2), determining both the class field and its width. The type of a value stored by a putstatic instruction must be compatible with the descriptor of the field (§4.3.2) of the class instance being stored into. If the field descriptor type is byte, char, short, or int, then the value must be an int. If the field descriptor type is float, long, or double, then the value must be a float, long, or double, respectively. If the field descriptor type is a reference type, then the value must be of a type that is assignment compatible (§2.6.6) with the field descriptor type.

The value is popped from the operand stack, and the class field is set to value.

Linking Exceptions
During resolution of the CONSTANT_Fieldref constant pool item, any of the exceptions documented in §5.2 can be thrown.

Otherwise, if the specified field exists but is not a static field (class variable), putstatic throws an Incompatible-Class-ChangeError.

Notes
The putstatic instruction operates on both one- and two-word wide fields.


Contents | Prev | Next | Index

Java Virtual Machine Specification (HTML generated by dkramer on February 25, 1997)
Copyright © 1996 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to doug.kramer@sun.com