title: What's the meaning of args.length?
body: <p>recently i've come across this piece of code and i really want to understand when and how to use this args.length </p>
  
  <pre><code>import java.util.*; 
  
  class Average
  {
  
  public static void main(String args[])
  
  {
  
  Scanner sc = new Scanner(System.in);
  
  int choice;
  
  int a=0,min=0,max=0,x;
  
  int n = args.length;
  
  System.out.println("1-Sum");
  
  System.out.println("2-Average");
  
  System.out.println("3-Minimum");
  
  System.out.println("4-Maximum");
  
  System.out.println("enter your choice");
  
  choice = sc.nextInt();
  
  for(int i=0;i&lt;n;i++)
  {
  
  a+=Integer.parseInt(args[i]);
  
  }
  
  switch(choice)
  
  {
  
  case 1: System.out.println("The sum is :" +a/n);
  
  break
  
  case 2: System.out.println("The Average is :" +a/n);
  
  break
  
  case 3: for(int i=0;i&lt;n-1;i++)
  
  {
  
  x=Integer.parseInt(args[i]);
  
  if(x&lt;Integer.parseInt(args[i+1]))
  
  min=x;
  
  else min=Integer.parseInt(args[i+1]);
  
  }
  
  System.out.println("The minimum is :" +min);
  
  break;
  
  case 4: for(int i=0;i&lt;n-1;i++)
  
  {
  
  x=Integer.parseInt(args[i]);
  
  if(x&gt;Integer.parseInt(args[i+1]))
  
  max = x;
  
  else max=Integer.parseInt(args[i+1]);
  
  }
  
  System.out.println("The maximum is :" +max);
  
  break;
  
  }
  
  }
  
  }
  </code></pre>