Join Stack Overflow to learn, share knowledge, and build your career. Connect and share knowledge within a single location that is structured and easy to search. In Java args contains the supplied command-line arguments as an array of String objects. In other words, if you run your program as java MyProgram one two then args will contain ["one", "two"].
public static void main (string args) Explanation
what is the meaning of public static void main(string args)
When you start learning java programming, this is the first method you encounter. Java main method is the entry point of any java program. Its syntax is always public static void main String args. You can only change the name of String array argument, for example you can change args to myStringArgs.
public static void main(String args) – Java main method
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. Explanation: Every word in the public static void main statement has got a meaning to the JVM. Apart from the above mentioned signature of main, you could use public static void main String args or public static void main String… args to call the main function in java. Java does not return int implicitly, even if we declare return type of main as int.
Notice the data type of the parameter variable args of the main method : String args. String name. The data type of the parameter variable args of the main method is an array of String!!! The data type of a is String args is the second element of this array. The data type of a is String And so on.