title: Using args [0] in Eclipse
body: <pre><code>    import java.util.Scanner;
  
      public class argu {
  
  public static void main(String[] args) 
  {
      int number = Integer.parseInt(args [0]);
      int x = number % 2;
  
      if (x == 0) {
          System.out.println("It is even");
  
      }
      else {
          System.out.println("It is not even");
      }
          }
      }
  </code></pre>
  
  <p>I have been trying to code this program to make an user enter a number, (that is the args [0] for), however, it sends this error.</p>
  
  <p>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
      at argu.main(argu.java:7)</p>
  
  <p>The fix I made was </p>
  
  <pre><code>    import java.util.Scanner;
  
      public class argu {
  
          public static void main(String[] args) 
          {
              Scanner scan = new Scanner (System.in);
  
      int number = scan.nextInt();
      int x = number % 2;
  
      if (x == 0) {
          System.out.println("It is even");
  
      }
      else {
          System.out.println("It is not even");
      }
          }
      }
  </code></pre>
  
  <p>I want to know if there is a way to user args [0] instead of the Scanner method. Keep in mind, I am a beginner, so I am sorry some of the stuff is wrong</p>
  
  <p>My other question is to help me analyze the method 
  Scanner scan = new Scanner (System.in);</p>
  
  <p>scan is the variable?
  Scanner is the method?
  I am confused with variables, parameters, and methods. If you could help me differentiate one from the other.</p>
  
  <p>Thank you.</p>