what is main method in java?

Java main() method is an entry point for our java application and the main() method will invoke all the other methods which are required for our program. So we can say the main method is used by JVM to start the execution of java program.

What if we don't have the main() method in a class?
package com.java2study;

public class Helloworld {

}
output
It seems Our programs compiles fine.but we got Error at Run time saying "main method is not found in class Helloworld ,please define the main method as:...."
What is main method signature in java?
main() method is predefined in JVM as below
public static void main(String[] args) {
  
 }
Example with main method
package com.java2study;

public class Helloworld {
public static void main(String[] args) {//main method
             System.out.println("Hello world Welcome to java2study");
  
 }

}
output
Lets Discuss more about main() method Lets See main method signature one more time
public static void main(String[] args) {
  
 }
Here We need to Look At The keywords public,static and retutn type void and commandLine arguements String[] args.Lets see one by one
why main() method declared as public?
main() method will be called by JVM from anywhere means outside of the class or outside the package for that purpose main() method declared as public
why main() method declares as static
JVM invokes the main() method with out creation of instance.for this main() method is static.
here void is return type main method doesn't return any thing to JVM.main is name of method which is configured in JVM. String[] args are commandline arguements.
Lets See some valid sigantures main() method
public static void main(String[] args)
static public void main(String[] args) 
public static void main(String []args
public static void main(String args[])
public static void main(String... args)
public static void main(String[] a)
and main method can declared with final,synchronized,strictfp like below
public static final synchronized strictfp void main(String[] args)
Example
package com.java2study;

public class Helloworld {
 public static final synchronized strictfp void main(String[] args){
             System.out.println("Hello world Welcome to java2study");
  
 }

}
output