Why we use string []args | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we use string []args

20th May 2019, 4:05 PM
LOLBUSTER1
2 Answers
0
In the main method ? Well as it's name suggest, the main method is a method and thus can take arguments like any other methods. Suppose your program's name is A. If another program (let's call it B) wants to start your program A. He can do so by calling the main method from A. Then, maybe B has information to give to A to allow it to run properly. That is done through the args arguments from the main method, under the form of an array of String Most of the time though, you may ignore these arguments as they won't be of any use, as your program won't have to interact with other programs and don't require arguments to launch it (from a command line for example, but that more advanced already)
20th May 2019, 4:17 PM
ThewyShift
ThewyShift - avatar