Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+18 votes

When I write a program, I accidentally put arg instead of args, and it still runs. There is no error.

asked in CSC211_Winter2018 by (8 points)

1 Answer

+9 votes

Technically you're just naming a variable there.

We usually name the variable args (which is short for "command line arguments"), but you could name it any other legal identifier (for example, String[] elephants, but that would be silly!).

So yes, your program will still work if you name the variable arg instead of args, but it's better to follow standard convention and make it plural.

answered by (15.6k points)