J.IX · Java 25 practice question

When does the JVM invoke the main method of the initial class or interface?

Choose one answer
Check answer and explanation

Correct answer: After completion of the initialization for the initial class or interface

Explanation

JLS SE 25 §12.1.4 specifies that the main method is invoked only after completion of the initialization for the initial class or interface.

Common trap

Static initializers run as part of class initialization and must finish before main begins. Linking and initialization complete before main is invoked; they do not run concurrently with main.

Source: JLS SE 25 §12.1.4. Invoke a main Method
Checked against the cited text on 2026-11-25.

Report an error in this question