Use of Static Block in Java
In this class, We discuss the Use of Static Block in Java.
The reader should have prior knowledge of static variables in Java. Click here.
Static Block:
A block of code written with the keyword static is called a static block.
Example:
The below diagram shows the example code.
In the above code, we have two static blocks.
We can write any number of static blocks.
Static blocks are executed when the class is loaded to Random access memory.
One of the uses of the static block is to initialize the static variables.
In real life, we have many uses for static blocks.
We can call static methods in static blocks.
Link for playlists:
/ @wisdomerscse
Link for our website: https://learningmonkey.in
Follow us on Facebook @ / learningmonkey
Follow us on Instagram @ / learningmonkey1
Follow us on Twitter @ / _learningmonkey
Mail us @ learningmonkey01@gmail.com
On this page of the site you can watch the video online Use of Static Block in Java || Lesson 47 || Java Programming || Learning Monkey || with a duration of hours minute second in good quality, which was uploaded by the user Wisdomers - Computer Science and Engineering 13 July 2023, share the link with friends and acquaintances, this video has already been watched 162 times on youtube and it was liked by 3 viewers. Enjoy your viewing!