Back to Browse

Difference between static block and instance block in java #javaprogramming #tamilexplanation

15 views
Nov 9, 2024
2:15

In Java, a static block is used to initialize static variables and is executed only once when the class is loaded into memory. It is mainly used for complex static variable initialization. An instance block (or initializer block) is used to initialize instance variables and runs every time an object of the class is created, just before the constructor is called. While static blocks are associated with the class itself, instance blocks are tied to object creation.

Download

0 formats

No download links available.

Difference between static block and instance block in java #javaprogramming #tamilexplanation | NatokHD