Repaso
EspaƱol
Java CoreFoundationsJV-49

What is public static void main(String[] args)?

Options

  1. The entry point: the method the JVM calls to start (Correct option)
  2. A required import that every Java file must contain
  3. A database command that starts a new connection
  4. A comment style that is used to document a class

Answer

The classic entry point: the method the JVM calls to start a Java program

Why

When you run java Hello, the JVM looks for a main method in that class and starts there.

  • public: callable from outside the class.
  • static: it belongs to the class, so no object is needed.
  • void: it returns nothing.
  • String[] args: the command-line arguments.

In Spring Boot, main is where SpringApplication.run(...) starts the app. JDK 25 also allows simpler forms such as void main() (JEP 512), but you will see the classic form almost everywhere.

Remember

main = where a Java program starts.

Key terms

Practice this question in Repaso