🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Object Initialization Order: all 10 questions

Quiz: Object Initialization Order · Question 2 of 10

When does a class's static block run?

When does a class's static block run?

  1. A.When the JVM starts, before main
  2. B.Every time an object is created
  3. C.Once, the first time the class is used
  4. D.Only when a static method is called
Answer & explanation

Correct answer: Once, the first time the class is used

Class initialisation happens once, on the first real use of the class.

Can you get the rest right without peeking?

Take the timed Quiz: Object Initialization Order quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →