Static Block and Static Variable in Java | Java Tutorial

This Java Tutorial “Static Block and Static Variable in Java” post explains clearly about static variable and static block and how these members execute in the java application.


Static Block:

  • Block of instructions with no identity.
  • We cannot access explicitly.
  • JVM invokes implicitly at the time of class loading.



Static Variable:

  • Declaration of variable inside class and outside to blocks and methods.
  • We must access using class name.
  • Static variable initializes with default values at the time of memory allocation.


  • Static variable get memory allocation inside method area.
  • Static Block and Static variable is having equal priority.
  • These members execute in the defined order.

Static block and Static variable Execution


Static variable and Block execution flow

Share this