Search code examples
javamethodsargumentsprogram-entry-pointargs

Does "args" have to be included in the main method?


In the standard public static void main(String[] args), I have noticed that (at least in Dr. Java), you can use other words besides args, but I have never seen any code that does deviate from this name.

My questions are

  • Will using other words work in all versions of Java and development environments?
  • Is the use of args just a convention?
  • If I use other names, will it be looked down upon?

Thank you for any help! I'm having trouble finding any answers online.


Solution

  • Yes the args variable is just convention. The variable name can be changed, but it is convention and you would be looked down upon. Source here.