Courseiva
Arrays and MethodshardMultiple SelectObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Which THREE statements are correct about the 'main' method signature in Java?

⚠ Common exam trap

Oracle often tests the misconception that the main method can have a non-void return type or a different name, tricking candidates who confuse it with other methods or C/C++ entry points.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

It must be declared public.

The Java Language Specification (JLS) requires the main method to be declared public so that the JVM can access it from outside the class. Without public visibility, the JVM would not be able to invoke the method as the entry point of the application.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • It must be declared public.

    Why this is correct

    JVM needs access to call it.

  • It can be declared to return an int.

    Why it's wrong here

    Must be void.

  • It must be declared void.

    Why this is correct

    The `main` method must be declared `void` because the Java Virtual Machine (JVM) specification strictly mandates this return type for the application's entry point. Deviating from `void` would prevent the JVM from recognising the method as the program's starting point, leading to a `NoSuchMethodError` or similar runtime issue. This requirement is a fundamental part of the `main` method's signature, ensuring all executable Java applications adhere to the standard `public static void main(String[] args)` definition.

  • It must be declared static.

    Why this is correct

    JVM calls it without an instance.

  • It can be named any valid identifier.

    Why it's wrong here

    Must be named main.

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.