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 and objectref, which must be of type reference
, are popped from the operand stack. The field at the offset from the start of the object referenced by objectref is set to the 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 a static
field, putfield throws an IncompatibleClassChangeError
.
Runtime Exception
Otherwise, if objectref is null
, the putfield instruction throws a NullPointerException
.
Notes
The putfield 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