Static Control Flow – Part 1

Video Link:

Static Control Flow
1. Identification of Static members from top to bottom
I=0 [RIWO] Read Indirectly Write only state
j=0 [RIWO]
2. Execution of Static variable assignment and static blocks from top to bottom
I=10 [R&W] Read and Write
j=20 [R&W]
3. Execution of main methods

Whenever we are executing a Java class the following sequence of steps will be executed as the part of static control flow
1. Identification of Static members from top to bottom [ 1 to 6]
2. Execution of Static variable assignment and static blocks from top to bottom [ 7 to 12]
3. Execution of main methods [13 to 15]

Read Indirectly Write Only
1. Inside a static block we are trying to read a variable that read operation is called Direct Read.
2. If we are calling a method and with-in that method if we are trying to read a variable that read operation is called In-direct read.
3. If a variable is just identified by JVM and original value not yet assigned then the variable is said to be in RIWO Read Indirect Write only state
4. If a variable is in RIWO state then we can’t perform direct Read but we can perform indirect read. If we are trying to read directly we will get compile Time error illegal forward reference.

Leave a Reply

Your email address will not be published. Required fields are marked *