What are static blocks in java ?



What are static blocks in java ?..

Answer / Mayank Srivastava

Static blocks in Java are used to initialize static variables. They are executed exactly once, when the class is loaded into the JVM. Static blocks can be used for initializing shared resources, setting up constants, or performing some setup work that needs to happen only once per class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

How will you reverse a link list without using recursion?

1 Answers   Global Logic,


How does multithreading take place on a computer with a single cpu in java programming?

1 Answers  


List primitive java types?

1 Answers  


What is command line argument

1 Answers   TCS,


who was the founder of java

32 Answers   CTS, HCL, ProKarma,


What does exclamation mean in java?

1 Answers  


What is java english?

1 Answers  


what really hapens when a object is created using new operator? 1.is it allocates memory to all variables and methods in the class with reference to that object?

3 Answers  


What is the requirement of thread in java?

1 Answers  


posted in online test

1 Answers  


What are the differences between this and super keyword?

1 Answers  


Can a static method be overridden in java?

1 Answers  


Categories