Hi
we want to know that if we put another argument in place of String array in main function then what will happened ?
Why main function have string type argument in java?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Apr 14, 2012, 4:51 AM EDT
The argument has to be a String array to accept any command line arguments that may be passed to it - no other type will do.
SenthilkumarRank #387 · 6.5K reputationPosted Apr 14, 2012, 5:38 AM EDT
It is fixed format. Either you can have the command line as arguments or nothing.
In case if you have any requirement to store other than string type then you need explicit type conversion.
If you change into any other data type and compilation will give the errors.
Hope this will help you.
VulpesRank #55 · 29.2K reputationPosted Apr 15, 2012, 5:18 AM EDT
There's nothing in the docs to say it's permissible and, when I tried it just now, I got a "could not find the main class" exception.