main method

The method the JVM calls first when it starts a program: public static void main(String[] args).

In more detail

It must be public so the JVM can see it and static so it can be called before any object exists. It returns nothing and receives the command-line arguments as an array of strings. Every part of the signature is fixed by the platform, which is part of the ceremony around a small Java program.

Example

public static void main(String[] args) { System.out.println("Hello"); }

Related terms

Taught in

References

Certification courses