You are on page 1of 2

A Java Class file has bytecodes of format

opcodeAdrress: opcode [operand]


1 byte

operand’s can be usually expressed by ‘Runtime constants’. To reduce


memory overhead (due to repeating) these constants are not directly
written but instead a reference to that constant obtained from Runtime
Constant Pool of the class currently being executed is written.Index of that
constant inside the Runtime Constant Pool is used as reference. The index
is of form ‘#integer’.

{
memberDeclarator;
descriptor: descriptor
flags: [flag]
/*For method, constructor, initializers*/
Code:
stack=num1, locals=num2, args_size=num3
---bytecode---
---bytecode---
......................
---bytecode---

memberDeclarator2;
------------------
------------------
------------------
}

descriptor: Describes type of the member. Example: ‘()V’ means member


takes no arguements and returns Void, ‘I’ means member is integer type
etc.

MemberDeclarator: Same as how you declare a member but without the


arguement identifier and all the types using fully qualified names.
Example: ‘int n’, ‘protected void fn(int)’ , ‘static java.lang.String k’ etc.
[01] Class Loading:

[02] Static Initialization: All the static field assignments and static blocks
are put inside a memberDeclarator: ‘static {}’, descriptor: ‘()V’
(indicating it takes no arguements and returns void) and flags:
ACC_STATIC. The bytecodes appear in same order as they are added in
the source file.
Execution of this ‘static {}’ member is called Static Initialization.

If a static final field is of primitive or String type or references to another


constant residing in the same class file then that filed can be accessed
without running static initializer.

You might also like