Why does the main method take (string[] args) as an argument by default? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

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

7th Jul 2016, 9:18 PM
Awni
Awni - avatar
2 Réponses
+ 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