Java main method

public static void main (String[] args)

public
public is access specifier which indicates that main() method can be called outside the class.

static
static methods can be called directly without creating an object of the class. It has to be static so that JVM can load the class in memory and call main method directly without creating an instance.

void
void indicates that the method main() doesn’t return a value.

main
This is name of the method and it is fixed because when Java program starts JVM looks for the method with specific name called main.

String[] args
This is command line arguments which can be passed as array of Strings.

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.