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
Sur cette page du site, vous pouvez voir la vidéo en ligne Use of Static Block in Java || Lesson 47 || Java Programming || Learning Monkey || durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Wisdomers - Computer Science and Engineering 13 juillet 2023, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 162 fois et il a aimé 3 téléspectateurs. Bon visionnage!