Skip to content
Sharp

JVM Architecture · interview question

What happens when a static initialization block is present in a Java class?

Multiple choiceMediumchapter-14-curatedpremiumjvm-architectureclass-loading
Choose one answer
Answer and explanation

Correct answer

D. It executes before any constructor

Why

Static initialization blocks execute when the class is loaded into memory by the JVM, before any object of the class is instantiated or any static method is invoked.

Test yourself on JVM Architecture

A free test with instant, explained results. No account needed.

Start free test
All JVM Architecture questions →