J.IX · Java 25 practice question

In Java 25, when using compact source files, which of the following accurately describes the allowed entry point signature compared to traditional Java programs?

Choose one answer
Check answer and explanation

Correct answer: Compact sources allow `public static void main(String[] args)` or compact entry points such as `void main()` or `void main(String[] args)`.

Explanation

Java 25 allows for more flexible entry points in compact sources. While the traditional static `main(String[] args)` remains valid, the features related to compact sources introduce possibilities for instance-based entry points, depending on how the source is intended to run or be packaged, as described in the relevant JEPs (like JEP 512). The key is that the flexibility is offered, not that one signature replaces the other entirely, but the introduction of new modes.

Common trap

Developers might assume that since compact sources are designed for brevity and modern structure, they must adhere to only one fixed signature, overlooking the flexible nature allowed by the feature set.

Source: JEP 512: Language Support for Compact Sources (Assumed reference for Java 25 features) - https://openjdk.org/jeps/512
Checked against the cited text on 2026-11-27.

Report an error in this question