What should you do if you want the user to pass numbers as command line arguments?
First read them as string and then parse them
declare the main method with an integer array instead of a String array
Don't use double quotes around the numbers. This way they will be read in as numbers
First read them as string and then parse them:
we need to read it as Strings because main method designed such way that it will accept the strings as parameters
if we change the main method than the passed parameters will not reach the actual main method
so only option we have is to accept it as string and parse to int later
Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Get Answers For Free
Most questions answered within 1 hours.