Why is the Java main method static?

The main method of java should be static because JVM has to call it without an existing object.

Since main() method is the entry point of any Java application, hence making the main() method as static is mandatory due to following reasons:

1. The static main() method makes it very clear for the JVM to call it for launching the Java Application. Otherwise, it would be required to specify the entry function for each Java application build, for the JVM to launch the application.

2. The method is static because otherwise there would be ambiguity which constructor should be called. Example:

public class MyClass
{
  protected MyClass(int m)
  {
  }
  public void main(String[] args)
  {
  }
}

The JVM now enters an ambiguity state deciding whether it should call new MyClass(int)? If yes, then what should it pass for m? If not, then should the JVM instantiate MyClass without executing any constructor method?

There are just too many edge cases and ambiguities like this for it to make sense for the JVM to have to instantiate a class before the entry point is called. That’s why main is static.

3. The main() method is static because its convenient for the JDK. Consider a scenario where it’s not mandatory to make main() method static. Then in this case, that just makes it harder on various IDEs to auto-detect the ‘launchable’ classes in a project. Hence making it a convention to make the entry method ‘main()’ as ‘public static void main(String[] args)’ is convenient.
Thus, the main() method in java is declared as static so that the JVM can access it directly using its class name before object creation.