Every method you create in Java you have to call, for example, say you create a method called myMethod(). In order to executive that method you have to write something like do myMethod(). How come you don’t have to write do main() after you define it? I know it doesn’t really matter, but I am very curious.
Share
The runtime invokes it automatically for you, when you execute java and give it a class.
That’s why there are very specific requirements for main. It’s special, being the method the runtime looks for when starting up. It’s the entry point into your program.
If there is no proper main method on the class that you try to run, you will get an error.