+ 2
Why we use (String [] args) in main method of Java?
Is it necessary to keep it as parameters of main method?
4 Respuestas
+ 5
As long as you provide a string array, the name doesn't really matter.
+ 3
It stores Java command line arguments and is an array of type String. Here, the name of the String array is “args” but it is not fixed and user can use any name in place of it
+ 3
I also wonder why is that compulsory. Not every java program is going to be run from command line. So why we need to pass String array .
String array parameter might be helpful but making it compulsory don't make sense. Passing String array to main is the thing that I forget the most.(I'm beginner of java)
I would like to hear why is that *Compulsory*
0
It's used it for work with string values