+ 2

[DUPLICATE] Why do we write (String [] args) in java program?

I use bluej on my desktop and i do not need to write this there. I am wondering from a long time that why do we write this code and what is its use?

17th Jun 2017, 2:31 PM
Mukund
Mukund - avatar
3 Answers
+ 7
â˜șâ˜șâ˜șâ˜șâ˜șâ˜șâ˜șhttps://stackoverflow.com/questions/890966/what-is-string-args-parameter-in-main-method-java😀😀😀😀😀😀😀
17th Jun 2017, 2:40 PM
Nithiwat
Nithiwat - avatar
+ 3
This code is simply an "argument" sent to the main method, telling it that the following codes after{ should be identified as an array of strings called "args", however you could call it anything. I haven't written any code without having to including the "arguments" so I can't say if a would work with them but it wouldn't return an error even if left blank though. It is simply a "signature" for the main method.
17th Jun 2017, 2:39 PM
Lini Benson Jr
Lini Benson Jr - avatar