Java-What is the meaning of public static void main(String [] args)?

In Java programs, the point from where the program starts its execution or simply the entry point of Java programs is the main() method. Hence, it is one of the most important methods of Java and having proper understanding of it is very important.

common syntax of main() method:

package com.knowledgefactory;

public class Knowledgefactory {

public static void main(String[] args) {
System.out.println("Hi, I am knowledgefactory");


In the above application example, we are using public static void main. Each word has a different meaning and purpose.

1.public: It is an Access modifier, which specifies from where and who can access the method. Making the main() method public makes it globally available. It is made public so that JVM can invoke it from outside the class as it is not present in the current class.

2.static:It is a keyword which is when associated with a method, makes it a class related method. The main() method is static so that JVM can invoke it without instantiating the class. This also saves the unnecessary wastage of memory which would have been used by the object declared only for calling the main() method by the JVM.

3.void:It is a keyword and used to specify that a method doesn’t return anything. As main() method doesn’t return anything, its return type is void. As soon as the main() method terminates, the java program terminates too. Hence, it doesn’t make any sense to return from main() method as JVM can’t do anything with the return value of it.

4.main:Main is the name of the Method. This Method name is searched by JVM as a starting point for an application with a particular signature only.

5.String[] args:Java main method accepts a single argument of type String array. This is also called as java command line arguments. 

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above