What is "String args[]"? parameter in main method Java -


i'm beginning write programs in java. following java code mean?

public static void main(string[] args) 
  • what string[] args?

  • when use these args?

source code and/or examples preferred on abstract explanations

in java args contains supplied command-line arguments array of string objects.

in other words, if run program java myprogram 1 two args contain ["one", "two"].

if wanted output contents of args, can loop through them this...

public class argumentexample {     public static void main(string[] args) {         for(int = 0; < args.length; i++) {             system.out.println(args[i]);         }     } } 

Comments