Smart Card Solution
User Manual
- R502 Manual
JavaCard API Samples
- Algorithm
Java Card Specification
Knowledge Sharing
Smart Card Solution
User Manual
JavaCard API Samples
Java Card Specification
Knowledge Sharing
Create new object
Format
new
indexbyte1
indexbyte2
Forms
new = 143 (0x8f)
Stack
… → …, objectref
Description
The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current package ( Section 3.5, Frames), where the value of the index is (indexbyte1 « 8) | indexbyte2. The item at that index in the constant pool must be of type CONSTANT_Classref ( Section 6.7.1, CONSTANT_Classref), a reference to a class or interface type. The reference is resolved and must result in a class type (it must not result in an interface type). Memory for a new instance of that class is allocated from the heap, and the instance variables of the new object are initialized to their default initial values. The objectref, a reference to the instance, is pushed onto the operand stack.
Notes
The new instruction does not completely create a new instance; instance creation is not completed until an instance initialization method has been invoked on the uninitialized instance.