Static Block in Java with Example

Published: 26 April 2018
on channel: Automation Testing By Experts
1,353
31

Static block -
Static blocks are the normal block of code, enclosed in braces { }, preceded with static keyword.
Static blocks are used to initialize the static data member.
Static block is executed before main method.
Static blocks will be executed at the time of class loading.
A class can have multiple Static blocks, which will be executed from Top to Bottom.

Static blocks will be executed at the time of class loading hence if we want to perform any activity at the time of class loading we have to define that activity inside static block.


On this page of the site you can watch the video online Static Block in Java with Example with a duration of hours minute second in good quality, which was uploaded by the user Automation Testing By Experts 26 April 2018, share the link with friends and acquaintances, this video has already been watched 1,353 times on youtube and it was liked by 31 viewers. Enjoy your viewing!