Static blocks in java
Introduction Hi everyone, it has been a while since I have put a new topic. In this blog post, I will be writing about static blocks in java. Static blocks is a block of code that get executed first when the class is loaded. Static block will be the first to execute when a class is called. Please check the below example. package com.blog.techjourney; public class StaticBlockExample { static { System.out.println( " Inside static block" ); } public static void main(String[] args) { System.out.println( " Inside main method" ); } } In the above example, the static block will get executed before the m...