Why does the main method take (string[] args) as an argument by default? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why does the main method take (string[] args) as an argument by default?

7th Jul 2016, 9:18 PM
Awni
Awni - avatar
2 ответов
+ 2
this is for the parameters passed to the program by. operating system, by command line or by shortcut. args[0] is the name of the executable file name (the program you've written), args[1] is the first argument passed to the program.
8th Jul 2016, 8:01 AM
Albert Gullbee
0
If I am correct now, the compiler looks for the method main with the parameters (string[] args).
8th Jul 2016, 4:52 AM
Andreas BeEm Kvist
Andreas BeEm Kvist - avatar