public static void main (string[ ] args) i have understood little bit that public means for whole method. static? void? main is a method which creates a string array named args. why the name args? please explain and correct if i am wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

public static void main (string[ ] args) i have understood little bit that public means for whole method. static? void? main is a method which creates a string array named args. why the name args? please explain and correct if i am wrong?

16th Aug 2016, 2:52 PM
rajat kumar raicha
rajat kumar raicha - avatar
3 Answers
+ 1
public means that the method you are going to create has public access i.e this method can be accessed by any other class. static means that this method is same for all objects of that class and can be called or used without creating objects of that class. . void means that it has no return type which means that when it will be called it will not return any value to the calling statement. main is the name of the method. string args[] means that this method requires parameter of type string. [] symbol means you are making an array . args is the name of the array of string and it depends on you to choose a name. you can give it any name. for eg. a[] , hell[] , boy[] , game[] etc.
20th Aug 2016, 6:20 PM
Satyam Abhishek Karn
Satyam Abhishek Karn - avatar
0
args [] is a string array that is used for command line arguments ,void is because it doesn't return a value
16th Aug 2016, 7:29 PM
Vaibhav Kaushik
Vaibhav Kaushik - avatar
0
public means that the method you are going to create has public access i.e this method can be accessed by any other class. static means that this method is same for all objects of that class and can be called or used without creating objects of that class. . void means that it has no return type which means that when it will be called it will not return any value to the calling statement. main is the name of the method. string args[] means that this method requires parameter of type string. [] symbol means you are making an array . args is the name of the array of string and it depends on you to choose a name. you can give it any name. for eg. a[] , hell[] , boy[] , game[] etc.
20th Aug 2016, 6:20 PM
Satyam Abhishek Karn
Satyam Abhishek Karn - avatar