What does main method do in Java? Why main method is public,static,void?

Lets try to understand, What does main method do in Java?

main method is entry point(like main gate of your house) of your stand alone java application.Having said that it means that if we have a Java project(Not a Web Project) which has many classes in it with lot of code(business logic),you need some starting point such that your code starts executing.main method is this starting point or entry gate,which then can call other classes code.
Lets take an example to check how main method gets called and how it calls other method
package com.blogspot.javasolutionsguide;

public class TestClass {
    public static void main(String[] args) {
        System.out.println("In TestClass");
        System.out.println(new TestClass1().display());  // calling TestClass1 display method
    }
}
package com.blogspot.javasolutionsguide;
public class TestClass1 {
    public String display(){
        return "In TestClass1";
    }
}
Let us run TestClass from command prompt or from within eclipse
command prompt :
java TestClass
Eclipse : Right click on class having main method or right click on project name ,then select Run as -> Java Applicaiton
Output :
In TestClass
In TestClass1
Additional Info :
1) If you right click on a class which does not have main method ,eclipse will not show you Run as->Java application option.
2) If you remove any of public,static,void or arguments of main method,it will not be identified by JVM, but it will be considered as overload of main method and hence will not be called by JVM.So we need to be sure that we are using correct signature of main method,if we want JVM to call this method and below are the possible signatures of main method :

Before Java 5 :
public static void main(String[] args);
After Java 5 :
public static void main(String... args);
Or
public static void main(String[] args);
Why main method is public, static, void and with String array argument?
Why main method is Public :

There are four access modifiers in Java viz. private, default, protected, public.

Class members : Instance variables + methods 

private : Class members with private access modifier can be accessed only from within that same class.

So what if main method would have been private? It could not be called by JVM which calls main from outside the class containing main method, but methods with private access are accessible only from within that class.

default : There is no such keyword as such "default", but class members without any access modifier have default access which is also called as package-private access, which means that such class members can be accessed from any class which are within same package as the class whose members we want to access.

So what if main method would have been defined with default level access, it could still not be called by JVM, as methods with default access can only be accessed from classes which are in same package.

protected : class members with protected access can be accessed from any class within same package plus from subclasses outside the package.

So what if main method would have been defined with protected access, it could still not be called by JVM, as methods with protected access can be accessed only from classes within same package and subclasses outside package.
public : class members with public access can be accessed from any class outside the class, be it classes in same package or classes in different package.
Now as JVM is sitting somewhere outside of classes of your project, so to call main method of your project, main method must have public access.
why main method is static
As main method is invoked by JVM and by that time(when JVM invokes main method) no object of class in which main method is defined exists, there should be some way to call main method. This is the reason main method has been forced by java specifications to be static. Now as static methods belong to class(and not objects),it can be called by JVM using class name.

why main method has void return type

As main method does not need to return anything to JVM, return type of main method is void.

What is the use of String array arguments in main method

main method accepts array of String. These are called command line arguments.
Consider following example :
package com.blogspot.javasolutionsguide;

public class TestClass {
    public static void main(String[] args) {
        System.out.println(args[0]);
        System.out.println("In TestClass");
    }
}
So if you are executing java program from command prompt as below :
java TestClass "hello"
Output will be :
hello
in TestClass
If you want to pass more than 1 argument, you can do like
Consider following example :
package com.blogspot.javasolutionsguide;

public class TestClass {
    public static void main(String[] args) {
        System.out.println(args[0]);
        System.out.println(args[1]);
        System.out.println("In TestClass")
    }
}
java TestClass "hello" "Quora"
and output will be
hello
Quora
in TestClass
This was just an example. In real projects you can pass some relevant arguments which will be required to your application at start up.
For example ,you can pass name of the applicationContext file(xml) in application using Spring,which then can be used in main method to load applicationContext.
Hope this article was helpful.If you have any comments,feedback,please dont hestitate to provide same in below comments section.